File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
regression/goto-instrument/dump-union2 Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,13 @@ union U6 {
1919
2020union U6 g_1197 = {1L };
2121
22+ union U4 {
23+ signed f0 : 6 ;
24+ int f3 ;
25+ };
26+
27+ union U4 g_1408 = {-1L };
28+
2229int main ()
2330{
2431 assert (g_2110 .f0 == 53747 );
Original file line number Diff line number Diff line change @@ -1450,7 +1450,8 @@ void dump_ct::cleanup_expr(exprt &expr)
14501450 ID_initializer_list,
14511451 std::move (designated_initializer2)};
14521452 expr.swap (initializer_list);
1453- break ;
1453+
1454+ return ;
14541455 }
14551456 }
14561457 }
@@ -1467,11 +1468,13 @@ void dump_ct::cleanup_expr(exprt &expr)
14671468 {
14681469 union_exprt union_expr{comp.get_name (), bu.value (), bu.op ().type ()};
14691470 expr.swap (union_expr);
1470- break ;
1471+
1472+ return ;
14711473 }
14721474 }
14731475 }
1474- else if (
1476+
1477+ if (
14751478 ns.follow (bu.type ()).id () == ID_union &&
14761479 bu.source_location ().get_function ().empty () &&
14771480 bu.op () == zero_initializer (bu.op ().type (), source_locationt{}, ns)
@@ -1485,9 +1488,14 @@ void dump_ct::cleanup_expr(exprt &expr)
14851488 {
14861489 union_exprt union_expr{comp.get_name (), bu.value (), bu.type ()};
14871490 expr.swap (union_expr);
1488- break ;
1491+
1492+ return ;
14891493 }
14901494 }
1495+
1496+ // we still haven't found a suitable component, so just ignore types and
1497+ // build an initializer list without designators
1498+ expr = unary_exprt{ID_initializer_list, bu.value ()};
14911499 }
14921500 }
14931501}
You can’t perform that action at this time.
0 commit comments