Skip to content

Commit 858532c

Browse files
Daniel Kroeningtautschnig
Daniel Kroening
authored andcommitted
Tolerate imprecision in value_sett
1 parent 15311a0 commit 858532c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/pointer-analysis/value_set.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,13 +1279,18 @@ void value_sett::assign(
12791279
"rhs.type():\n" +
12801280
rhs.type().pretty() + "\n" + "lhs.type():\n" + lhs.type().pretty());
12811281

1282-
const struct_typet &rhs_struct_type =
1283-
to_struct_type(ns.follow(rhs.type()));
1282+
const typet &followed = ns.follow(rhs.type());
12841283

1285-
const typet &rhs_subtype = rhs_struct_type.component_type(name);
1286-
rhs_member = simplify_expr(member_exprt{rhs, name, rhs_subtype}, ns);
1284+
if(followed.id() == ID_struct || followed.id() == ID_union)
1285+
{
1286+
const struct_union_typet &rhs_struct_union_type =
1287+
to_struct_union_type(followed);
1288+
1289+
const typet &rhs_subtype = rhs_struct_union_type.component_type(name);
1290+
rhs_member = simplify_expr(member_exprt{rhs, name, rhs_subtype}, ns);
12871291

1288-
assign(lhs_member, rhs_member, ns, true, add_to_sets);
1292+
assign(lhs_member, rhs_member, ns, true, add_to_sets);
1293+
}
12891294
}
12901295
}
12911296
}

0 commit comments

Comments
 (0)