From 786f4b93d9a2bed0fe76cc183cec3cb2a13c6b9b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 5 Apr 2010 04:00:28 +0000 Subject: STP: Avoid use of zero-sized array GNU extension. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@100388 91177308-0d34-0410-b5e6-96231b3b80d8 --- stp/sat/SolverTypes.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stp/sat/SolverTypes.h b/stp/sat/SolverTypes.h index 2b98b8ca..90e7a9bd 100644 --- a/stp/sat/SolverTypes.h +++ b/stp/sat/SolverTypes.h @@ -68,7 +68,7 @@ const Lit lit_Error(var_Undef, true ); // } class Clause { uint size_etc; union { float act; uint abst; } apa; - Lit data[0]; + Lit data[1]; public: // NOTE: This constructor cannot be used directly (doesn't allocate enough memory). template @@ -82,7 +82,8 @@ public: friend Clause* Clause_new(const V& ps, bool learnt = false) { assert(sizeof(Lit) == sizeof(uint)); assert(sizeof(float) == sizeof(uint)); - void* mem = xmalloc(sizeof(Clause) + sizeof(uint)*(ps.size())); + void* mem = xmalloc(sizeof(Clause) + + sizeof(uint)*(ps.size() - 1)); return new (mem) Clause(ps, learnt); } int size () const { return size_etc >> 3; } -- cgit 1.4.1