]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
* Don't allow creation of zero-width bitvector literals. Previously bv0[0] would...
authortrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 20 Sep 2009 15:47:09 +0000 (15:47 +0000)
committertrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 20 Sep 2009 15:47:09 +0000 (15:47 +0000)
* If optimisations were disabled, sign_extend[0], would segfault in the bitblaster.

git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@243 e59a4935-1847-0410-ae03-e826735625c1

src/AST/AST.cpp
src/to-sat/BitBlast.cpp

index ee5a4a2124253dfbedcb5463d112aa7a1a24f151..e7f5aedec2e4c43e1d363e8a74e3cfd4e2b59726 100644 (file)
@@ -365,6 +365,10 @@ namespace BEEV
   ASTNode BeevMgr::CreateBVConst(string*& strval, int base, int bit_width)
   {
 
+       if (bit_width <= 0)
+           FatalError("CreateBVConst: trying to create a bvconst of width: ", ASTUndefined, bit_width);
+
+
     if (!(2 == base || 10 == base || 16 == base))
       {
         FatalError("CreateBVConst: unsupported base: ", ASTUndefined, base);
index e71867a6617d68b362483ddd627110f53841d40b..318eaed8b582594395fe672babacae08a4a68326 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "../AST/AST.h"
 #include <cmath>
+#include <cassert>
 
 namespace BEEV
 {
@@ -169,6 +170,7 @@ namespace BEEV
           if (result_width == arg_width)
             {
               //nothing to sign extend
+                         result = arg;
               break;
             }
           else
@@ -484,6 +486,7 @@ namespace BEEV
     // lpvec(result);
     // cout << endl;
 
+    assert(!result.IsNull());
     return (BBTermMemo[term] = result);
 
   }