File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed
regression/goto-instrument/dump-side-effect Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 1+ struct S
2+ {
3+ int bf : 2 ;
4+ };
5+
6+ int foo ()
7+ {
8+ return 0 ;
9+ }
10+
11+ int main ()
12+ {
13+ struct S s ;
14+ struct S * sp = & s ;
15+ if (sp [0 ].bf = foo ())
16+ return 0 ;
17+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+ --dump-c
4+ VERIFICATION SUCCESSFUL
5+ ^EXIT=0$
6+ ^SIGNAL=0$
7+ --
8+ ^warning: ignoring
9+ --
10+ This test must verify successfully also for the output generated using dump-c,
11+ which previously would fail to compile for it included a type cast on a
12+ left-hand side.
Original file line number Diff line number Diff line change @@ -395,9 +395,10 @@ void goto_convertt::clean_expr(
395395 }
396396
397397 // turn into code
398- code_assignt assignment;
399- assignment.lhs ()=lhs;
400- assignment.rhs () = side_effect_assign.rhs ();
398+ exprt new_lhs = skip_typecast (lhs);
399+ exprt new_rhs = typecast_exprt::conditional_cast (
400+ side_effect_assign.rhs (), new_lhs.type ());
401+ code_assignt assignment (std::move (new_lhs), std::move (new_rhs));
401402 assignment.add_source_location ()=expr.source_location ();
402403 convert_assign (assignment, dest, mode);
403404
You can’t perform that action at this time.
0 commit comments