Skip to content

Commit a12526a

Browse files
authored
Merge pull request #6762 from tautschnig/bugfixes/fs-array_equal
Full slicing: fix bugs in handling array_equal
2 parents e6b943f + e098f86 commit a12526a

File tree

4 files changed

+33
-10
lines changed

4 files changed

+33
-10
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CORE
2+
main.c
3+
--full-slice
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^\[test_copy\.assertion\.4\] .* expected to fail: FAILURE$
7+
^\[test_unequal\.assertion\.1\] .* different sizes arrays are unequal: SUCCESS
8+
^\[test_unequal\.assertion\.2\] .* expected to fail: FAILURE
9+
^\[test_unequal\.assertion\.3\] .* different typed arrays are unequal: SUCCESS
10+
^\[test_unequal\.assertion\.4\] .* expected to fail: FAILURE
11+
^\[test_unequal\.assertion\.5\] .* expected to fail: FAILURE
12+
^\[test_unequal\.assertion\.6\] .* expected to fail: FAILURE
13+
^\*\* 5 of 14 failed
14+
^VERIFICATION FAILED$
15+
--
16+
^warning: ignoring
17+
--
18+
Verify the properties of various cprover array primitves

src/analyses/goto_rw.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -805,11 +805,14 @@ static void goto_rw_other(
805805
else if(statement == ID_array_equal)
806806
{
807807
// mark the dereferenced operands as being read
808-
for(const auto &op : code.operands())
809-
{
810-
rw_set.get_array_objects(
811-
function, target, rw_range_sett::get_modet::READ, op);
812-
}
808+
PRECONDITION(code.operands().size() == 3);
809+
rw_set.get_array_objects(
810+
function, target, rw_range_sett::get_modet::READ, code.op0());
811+
rw_set.get_array_objects(
812+
function, target, rw_range_sett::get_modet::READ, code.op1());
813+
// the third operand is the result
814+
rw_set.get_objects_rec(
815+
function, target, rw_range_sett::get_modet::LHS_W, code.op2());
813816
}
814817
else if(statement == ID_array_set)
815818
{

src/pointer-analysis/value_set.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,8 +1615,7 @@ void value_sett::apply_code_rec(
16151615
{
16161616
// can be ignored, we don't expect side effects here
16171617
}
1618-
else if(statement=="cpp_delete" ||
1619-
statement=="cpp_delete[]")
1618+
else if(statement == ID_cpp_delete || statement == ID_cpp_delete_array)
16201619
{
16211620
// does nothing
16221621
}
@@ -1653,6 +1652,9 @@ void value_sett::apply_code_rec(
16531652
else if(statement==ID_array_replace)
16541653
{
16551654
}
1655+
else if(statement == ID_array_equal)
1656+
{
1657+
}
16561658
else if(statement==ID_assume)
16571659
{
16581660
guard(to_code_assume(code).assumption(), ns);

src/pointer-analysis/value_set_fi.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,9 +1390,9 @@ void value_set_fit::apply_code(const codet &code, const namespacet &ns)
13901390
else if(statement==ID_fence)
13911391
{
13921392
}
1393-
else if(statement==ID_array_copy ||
1394-
statement==ID_array_replace ||
1395-
statement==ID_array_set)
1393+
else if(
1394+
statement == ID_array_copy || statement == ID_array_replace ||
1395+
statement == ID_array_set || statement == ID_array_equal)
13961396
{
13971397
}
13981398
else if(can_cast_expr<code_inputt>(code) || can_cast_expr<code_outputt>(code))

0 commit comments

Comments
 (0)