File tree 4 files changed +28
-20
lines changed
regression/cbmc/nested_label1
4 files changed +28
-20
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ int main ()
4
+ {
5
+ goto label2 ;
6
+ goto out ;
7
+ label1 :
8
+ label2 :
9
+ label3 :
10
+ assert (0 );
11
+ out :
12
+ return 0 ;
13
+ }
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
9
+ --
10
+ This test checks that the assertion is reachable despite being wrapped in a
11
+ nested list of labels, and that jumping to a label in the middle of that list is
12
+ handled correctly.
Original file line number Diff line number Diff line change @@ -262,6 +262,7 @@ rm memory_allocation1/test.desc
262
262
rm memset1/test.desc
263
263
rm memset3/test.desc
264
264
rm mm_io1/test.desc
265
+ rm nested_label1/test.desc
265
266
rm no_nondet_static/test.desc
266
267
rm null1/test.desc
267
268
rm null2/test.desc
Original file line number Diff line number Diff line change @@ -193,26 +193,8 @@ void c_typecheck_baset::typecheck_block(code_blockt &code)
193
193
194
194
for (auto &code_op : code.statements ())
195
195
{
196
- if (code_op.is_nil ())
197
- continue ;
198
-
199
- if (code_op.get_statement ()==ID_label)
200
- {
201
- // these may be nested
202
- codet *code_ptr=&code_op;
203
-
204
- while (code_ptr->get_statement ()==ID_label)
205
- {
206
- assert (code_ptr->operands ().size ()==1 );
207
- code_ptr=&to_code (code_ptr->op0 ());
208
- }
209
-
210
- // codet &label_op=*code_ptr;
211
-
212
- new_ops.move (code_op);
213
- }
214
- else
215
- new_ops.move (code_op);
196
+ if (code_op.is_not_nil ())
197
+ new_ops.add (std::move (code_op));
216
198
}
217
199
218
200
code.statements ().swap (new_ops.statements ());
You can’t perform that action at this time.
0 commit comments