Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/non-local-goto-2.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* { dg-do run } */ | |
2 /* { dg-options "-O2" } */ | |
3 /* { dg-require-effective-target nonlocal_goto } */ | |
4 | |
5 extern void abort (void); | |
6 | |
7 int global; | |
8 | |
9 static int foo(void) __attribute__((noinline)); | |
10 | |
11 static int foo(void) | |
12 { | |
13 global = 1; | |
14 } | |
15 | |
16 static int bar(void) | |
17 { | |
18 foo (); | |
19 global = 0; | |
20 } | |
21 | |
22 int execute(int cmd) | |
23 { | |
24 __label__ start; | |
25 | |
26 void raise(void) | |
27 { | |
28 goto start; | |
29 } | |
30 | |
31 int last; | |
32 | |
33 bar (); | |
34 | |
35 last = 0; | |
36 | |
37 start: | |
38 | |
39 if (last == 0) | |
40 while (1) | |
41 { | |
42 last = 1; | |
43 raise (); | |
44 } | |
45 | |
46 if (last == 0) | |
47 return 0; | |
48 else | |
49 return cmd; | |
50 } | |
51 | |
52 int main(void) | |
53 { | |
54 if (execute (1) == 0) | |
55 abort (); | |
56 | |
57 return 0; | |
58 } |