File tree 3 files changed +43
-0
lines changed
regression/cbmc/Local_out_of_scope3
3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ unsigned int * GLOBAL_POINTER [1 ];
2
+
3
+ int index ;
4
+
5
+ void f (void )
6
+ {
7
+ unsigned int actual = 0u ;
8
+ GLOBAL_POINTER [0 ] = & actual ;
9
+
10
+ if (index == 0 )
11
+ * GLOBAL_POINTER [index ] = 1u ;
12
+ else
13
+ actual = 2u ;
14
+
15
+ __CPROVER_assume (1u == actual );
16
+ }
17
+
18
+ void main (void )
19
+ {
20
+ index = nondet_int ();
21
+ f ();
22
+ f ();
23
+ __CPROVER_assert (0 == 1 , "" );
24
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -209,6 +209,17 @@ void goto_symext::symex_assign_symbol(
209
209
guardt &guard,
210
210
assignment_typet assignment_type)
211
211
{
212
+ // do not assign to L1 objects that have gone out of scope --
213
+ // pointer dereferencing may yield such objects; parameters do not
214
+ // have an L2 entry set up beforehand either, so exempt them from
215
+ // this check (all other L1 objects should have seen a declaration)
216
+ const symbolt *s;
217
+ if (!ns.lookup (lhs.get_object_name (), s) &&
218
+ !s->is_parameter &&
219
+ !lhs.get_level_1 ().empty () &&
220
+ state.level2 .current_count (lhs.get_identifier ())==0 )
221
+ return ;
222
+
212
223
exprt ssa_rhs=rhs;
213
224
214
225
// put assignment guard into the rhs
You can’t perform that action at this time.
0 commit comments