aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-04-05 04:00:28 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-04-05 04:00:28 +0000
commit786f4b93d9a2bed0fe76cc183cec3cb2a13c6b9b (patch)
treebc4b1774e861ed4390de653d8f6da9a9d97031b5
parentb0e4742ded7e5b27b704e44405fe915f7b1c8110 (diff)
downloadklee-786f4b93d9a2bed0fe76cc183cec3cb2a13c6b9b.tar.gz
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
-rw-r--r--stp/sat/SolverTypes.h5
1 files 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<class V>
@@ -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<char>(sizeof(Clause) + sizeof(uint)*(ps.size()));
+ void* mem = xmalloc<char>(sizeof(Clause) +
+ sizeof(uint)*(ps.size() - 1));
return new (mem) Clause(ps, learnt); }
int size () const { return size_etc >> 3; }