Skip to content

Commit 05769c0

Browse files
authored
Merge pull request diffblue#4519 from tautschnig/float-byte-extract
Use bv_typet to fix type consistency in byte-operator lowering
2 parents eed359b + ee07f0a commit 05769c0

File tree

16 files changed

+158
-106
lines changed

16 files changed

+158
-106
lines changed

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/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_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$

src/solvers/flattening/boolbv_typecast.cpp

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ bool boolbvt::type_conversion(
260260
{
261261
INVARIANT(
262262
src_width == dest_width,
263-
"source bitvector with shall equal the destination bitvector width");
263+
"source bitvector width shall equal the destination bitvector width");
264264
dest=src;
265265
return false;
266266
}
@@ -415,24 +415,31 @@ bool boolbvt::type_conversion(
415415
}
416416
break;
417417

418-
default:
419-
if(src_type.id()==ID_bool)
420-
{
421-
// bool to integer
422-
418+
case bvtypet::IS_BV:
423419
INVARIANT(
424-
src_width == 1, "bitvector of type boolean shall have width one");
420+
src_width == dest_width,
421+
"source bitvector width shall equal the destination bitvector width");
422+
dest = src;
423+
return false;
425424

426-
for(std::size_t i=0; i<dest_width; i++)
425+
default:
426+
if(src_type.id() == ID_bool)
427427
{
428-
if(i==0)
429-
dest.push_back(src[0]);
430-
else
431-
dest.push_back(const_literal(false));
432-
}
428+
// bool to integer
433429

434-
return false;
435-
}
430+
INVARIANT(
431+
src_width == 1, "bitvector of type boolean shall have width one");
432+
433+
for(std::size_t i = 0; i < dest_width; i++)
434+
{
435+
if(i == 0)
436+
dest.push_back(src[0]);
437+
else
438+
dest.push_back(const_literal(false));
439+
}
440+
441+
return false;
442+
}
436443
}
437444
break;
438445

0 commit comments

Comments
 (0)