File tree 2 files changed +11
-1
lines changed
regression/cbmc/gcc_conditional_expr1
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
1
3
int g , k ;
2
4
5
+ // See https://gcc.gnu.org/onlinedocs/gcc/Conditionals.html
3
6
int main ()
4
7
{
5
8
int r1 , r2 ;
@@ -14,4 +17,10 @@ int main()
14
17
assert (r2 == 1 );
15
18
assert (g == 2 );
16
19
assert (k == 0 );
20
+
21
+ int in_decl = g ++ ?: 0 ;
22
+ assert (in_decl == 2 );
23
+ assert (g == 3 );
24
+
25
+ return 0 ;
17
26
}
Original file line number Diff line number Diff line change @@ -758,7 +758,8 @@ void goto_convertt::convert_assign(
758
758
(rhs.get (ID_statement) == ID_assign ||
759
759
rhs.get (ID_statement) == ID_postincrement ||
760
760
rhs.get (ID_statement) == ID_preincrement ||
761
- rhs.get (ID_statement) == ID_statement_expression))
761
+ rhs.get (ID_statement) == ID_statement_expression ||
762
+ rhs.get (ID_statement) == ID_gcc_conditional_expression))
762
763
{
763
764
// handle above side effects
764
765
clean_expr (rhs, dest, mode);
You can’t perform that action at this time.
0 commit comments