Skip to content

Commit 8368cc1

Browse files
Daniel Kroeningtautschnig
Daniel Kroening
authored andcommitted
Tolerate three cases of imprecision in value_set_fi
Fixes: #2653
1 parent a3e1411 commit 8368cc1

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

src/pointer-analysis/value_set_fi.cpp

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -410,17 +410,18 @@ void value_set_fit::get_value_set_rec(
410410
{
411411
const typet &type = to_index_expr(expr).array().type();
412412

413-
DATA_INVARIANT(type.id()==ID_array ||
414-
type.id()=="#REF#",
415-
"operand 0 of index expression must be an array");
416-
417-
get_value_set_rec(
418-
to_index_expr(expr).array(),
419-
dest,
420-
"[]" + suffix,
421-
original_type,
422-
ns,
423-
recursion_set);
413+
if(type.id() == ID_array)
414+
{
415+
get_value_set_rec(
416+
to_index_expr(expr).array(),
417+
dest,
418+
"[]" + suffix,
419+
original_type,
420+
ns,
421+
recursion_set);
422+
}
423+
else
424+
insert(dest, exprt(ID_unknown, original_type));
424425

425426
return;
426427
}
@@ -1192,12 +1193,15 @@ void value_set_fit::assign_rec(
11921193
{
11931194
const typet &type = to_index_expr(lhs).array().type();
11941195

1195-
DATA_INVARIANT(type.id()==ID_array ||
1196-
type.id()=="#REF#",
1197-
"operand 0 of index expression must be an array");
1198-
1199-
assign_rec(
1200-
to_index_expr(lhs).array(), values_rhs, "[]" + suffix, ns, recursion_set);
1196+
if(type.id() == ID_array || type.id() == ID_incomplete_array)
1197+
{
1198+
assign_rec(
1199+
to_index_expr(lhs).array(),
1200+
values_rhs,
1201+
"[]" + suffix,
1202+
ns,
1203+
recursion_set);
1204+
}
12011205
}
12021206
else if(lhs.id()==ID_member)
12031207
{
@@ -1239,9 +1243,9 @@ void value_set_fit::assign_rec(
12391243

12401244
assign_rec(typecast_expr.op(), values_rhs, suffix, ns, recursion_set);
12411245
}
1242-
else if(lhs.id()=="zero_string" ||
1243-
lhs.id()=="is_zero_string" ||
1244-
lhs.id()=="zero_string_length")
1246+
else if(
1247+
lhs.id() == "zero_string" || lhs.id() == "is_zero_string" ||
1248+
lhs.id() == "zero_string_length" || lhs.id() == ID_address_of)
12451249
{
12461250
// ignore
12471251
}

0 commit comments

Comments
 (0)