Skip to content

Commit 0ee0583

Browse files
committed
Use bv_typet to fix type consistency in byte-operator lowering
Previously we fixed the extracted bytes to be unsigned bitvectors, but we should not actually impose (un)signedness as we do not actually interpret the bytes as numeric values. This fixes byte operators over floating-point values, and makes various SMT-solver tests pass as the SMT back-end is more strict about typing and therefore was more frequently affected by this bug. To make all this work it was also necessary to extend and fix the simplifier's handling of bv_typet expressions, and also cover one more case of type casts in the bitvector back-end.
1 parent eed359b commit 0ee0583

File tree

22 files changed

+146
-97
lines changed

22 files changed

+146
-97
lines changed

regression/cbmc/Array_operations1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33

44
^EXIT=10$

regression/cbmc/Bitfields3/paths.desc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ main.c
66
^VERIFICATION SUCCESSFUL$
77
--
88
^warning: ignoring
9+
--
10+
This test is marked broken-smt-backend for performance reasons only: it passes,
11+
but takes 5 seconds to do so.

regression/cbmc/Bitfields3/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--pointer-check --bounds-check
44
^EXIT=0$

regression/cbmc/Float-equality1/test_no_equality.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33

44
^EXIT=0$

regression/cbmc/Malloc23/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--pointer-check
44
^EXIT=10$

regression/cbmc/Pointer_Arithmetic11/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--pointer-check --little-endian
44
^EXIT=0$

regression/cbmc/Pointer_byte_extract2/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--little-endian
44
^EXIT=10$

regression/cbmc/Pointer_byte_extract9/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33

44
^EXIT=10$

regression/cbmc/Quantifiers-assignment/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33

44
^\*\* Results:$

regression/cbmc/byte_update3/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--little-endian
44
^EXIT=0$

regression/cbmc/byte_update5/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--little-endian
44
^EXIT=0$

regression/cbmc/memory_allocation1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--pointer-check
44
^EXIT=10$

regression/cbmc/memory_allocation2/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--bounds-check
44
^EXIT=10$

regression/cbmc/union12/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--pointer-check
44
^EXIT=10$

regression/cbmc/union6/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--little-endian
44
^EXIT=0$

regression/cbmc/union7/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE broken-smt-backend
1+
CORE
22
main.c
33
--big-endian
44
^EXIT=0$

src/solvers/flattening/boolbv_typecast.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,13 @@ bool boolbvt::type_conversion(
415415
}
416416
break;
417417

418+
case bvtypet::IS_BV:
419+
INVARIANT(
420+
src_width == dest_width,
421+
"source bitvector with shall equal the destination bitvector width");
422+
dest=src;
423+
return false;
424+
418425
default:
419426
if(src_type.id()==ID_bool)
420427
{

0 commit comments

Comments
 (0)