diff options
-rw-r--r-- | lib/Expr/Expr.cpp | 2 | ||||
-rw-r--r-- | test/Expr/Parser/ConstantFolding.pc | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index 763a4be1..4d9e5abe 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -423,7 +423,7 @@ ref<ConstantExpr> ConstantExpr::AShr(const ref<ConstantExpr> &RHS) { } ref<ConstantExpr> ConstantExpr::Not() { - return ConstantExpr::alloc(value == 0, Expr::Bool); + return ConstantExpr::alloc(~value); } ref<ConstantExpr> ConstantExpr::Eq(const ref<ConstantExpr> &RHS) { diff --git a/test/Expr/Parser/ConstantFolding.pc b/test/Expr/Parser/ConstantFolding.pc index 56895e53..2c8a4c52 100644 --- a/test/Expr/Parser/ConstantFolding.pc +++ b/test/Expr/Parser/ConstantFolding.pc @@ -190,3 +190,8 @@ array a[64] : w32 -> w8 = symbolic # RUN: grep -A 2 \"# Query 36$\" %t > %t2 # RUN: grep \"(query .. false .(Eq 0 (Read w8 0 a)).\" %t2 (query [] false [(Not (Not (Eq 0 (Read w8 0 a))))]) + +# Check -- !Const +# RUN: grep -A 2 \"# Query 37$\" %t > %t2 +# RUN: grep \"(query .. false .true.\" %t2 +(query [] false [(Eq (Not w32 0xdeadbeef) 0x21524110)]) |