File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -1470,14 +1470,14 @@ simplify_exprt::resultt<> simplify_exprt::simplify_with(const with_exprt &expr)
14701470 expr.old ().type ().id () == ID_struct ||
14711471 expr.old ().type ().id () == ID_struct_tag)
14721472 {
1473+ const struct_typet &old_type_followed =
1474+ expr.old ().type ().id () == ID_struct_tag
1475+ ? ns.follow_tag (to_struct_tag_type (expr.old ().type ()))
1476+ : to_struct_type (expr.old ().type ());
1477+ const irep_idt &component_name = expr.where ().get (ID_component_name);
1478+
14731479 if (expr.old ().id () == ID_struct || expr.old ().is_constant ())
14741480 {
1475- const irep_idt &component_name = expr.where ().get (ID_component_name);
1476-
1477- const struct_typet &old_type_followed =
1478- expr.old ().type ().id () == ID_struct_tag
1479- ? ns.follow_tag (to_struct_tag_type (expr.old ().type ()))
1480- : to_struct_type (expr.old ().type ());
14811481 if (!old_type_followed.has_component (component_name))
14821482 return unchanged (expr);
14831483
@@ -1490,6 +1490,12 @@ simplify_exprt::resultt<> simplify_exprt::simplify_with(const with_exprt &expr)
14901490 result.operands ()[number] = expr.new_value ();
14911491 return result;
14921492 }
1493+ else if (
1494+ old_type_followed.components ().size () == 1 &&
1495+ old_type_followed.has_component (component_name))
1496+ {
1497+ return struct_exprt{{expr.new_value ()}, expr.type ()};
1498+ }
14931499 }
14941500 else if (
14951501 expr.old ().type ().id () == ID_array || expr.old ().type ().id () == ID_vector)
You can’t perform that action at this time.
0 commit comments