File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
regression/cbmc/string_assignment1 Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1+ typedef char array_t [2 ][2 ];
2+
3+ void foo (array_t (* a ))
4+ {
5+ unsigned char i = 0 ;
6+ unsigned char j = 0 ;
7+ (* a )[i ][j ] = 0 ;
8+ }
9+
10+ unsigned char main ()
11+ {
12+ char * x = "abcd" ;
13+ foo (x );
14+ __CPROVER_assert (x [0 ] == 'a' , "a" );
15+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+
4+ ^VERIFICATION SUCCESSFUL$
5+ ^EXIT=0$
6+ ^SIGNAL=0$
7+ --
8+ ^l2_rename_rvalues case `array' not handled
9+ ^warning: ignoring
10+ --
11+ The assignment to a C string constant should be ignored by symex, even when it
12+ happens via a type cast to a two-dimensional array.
Original file line number Diff line number Diff line change @@ -251,7 +251,8 @@ class goto_symex_statet final : public goto_statet
251251 // simplifies to a plain constant.
252252 return lvalue.id () == ID_string_constant || lvalue.id () == ID_null_object ||
253253 lvalue.id () == " zero_string" || lvalue.id () == " is_zero_string" ||
254- lvalue.id () == " zero_string_length" || lvalue.id () == ID_constant;
254+ lvalue.id () == " zero_string_length" || lvalue.id () == ID_constant ||
255+ lvalue.id () == ID_array;
255256 }
256257
257258private:
You can’t perform that action at this time.
0 commit comments