File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
regression/goto-instrument/labels1 Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+ #include <stdlib.h>
3+
4+ int foo ()
5+ {
6+ return 1 ;
7+ }
8+
9+ typedef int (* fptr_t )(void );
10+
11+ int main ()
12+ {
13+ label_zero :
14+ assert (1 );
15+ int x ;
16+ int * p ;
17+ goto label_two ;
18+ label_one :
19+ assert (x < 0 || x >= 0 );
20+ label_two :
21+ p = malloc (sizeof (int ));
22+ label_three :
23+ if (foo ())
24+ x = 42 ;
25+ label_four :
26+ assert (foo () == 1 );
27+ label_five :
28+ fptr_t fp = foo ;
29+ assert (fp () == 1 );
30+ label_six :
31+ return * p ;
32+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+
4+ Labels: label_zero$
5+ Labels: label_one$
6+ Labels: label_two$
7+ Labels: label_three$
8+ Labels: label_four$
9+ Labels: label_five$
10+ Labels: label_six$
11+ ^EXIT=0$
12+ ^SIGNAL=0$
13+ --
14+ ^warning: ignoring
15+ --
16+ This test ensures that label names specified in the source code are preserved.
Original file line number Diff line number Diff line change @@ -527,6 +527,7 @@ class goto_programt
527527 swap (instruction._type , _type);
528528 swap (instruction.guard , guard);
529529 swap (instruction.targets , targets);
530+ swap (instruction.labels , labels);
530531 }
531532
532533 // / Uniquely identify an invalid target or location
You can’t perform that action at this time.
0 commit comments