ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 94b4364 was
b1d6dd5,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
fix parsing error for EOF message, change cfa-ccp -x flag to -v, regression testing third attempt: consolidate example programs
|
-
Property mode set to
100644
|
File size:
2.0 KB
|
Line | |
---|
1 | int main() { |
---|
2 | int i; |
---|
3 | int x, y; |
---|
4 | |
---|
5 | x = 0; y = 0; |
---|
6 | |
---|
7 | // block, labelled exits |
---|
8 | |
---|
9 | Block: { |
---|
10 | if ( x == y ) { |
---|
11 | for ( ; i < y; ) { |
---|
12 | y += 1; |
---|
13 | if ( y < 10 ) break Block; |
---|
14 | } |
---|
15 | } |
---|
16 | } |
---|
17 | |
---|
18 | // loops, labelled exits |
---|
19 | |
---|
20 | w1: while ( y == 10 ); |
---|
21 | |
---|
22 | w2: while ( x < 10 ) { |
---|
23 | while (y < 5 ) { |
---|
24 | if ( y == 3 ) break w2; |
---|
25 | } |
---|
26 | x += 1; |
---|
27 | } |
---|
28 | |
---|
29 | A: for ( i = 0; i < 10; i += 1 ) { |
---|
30 | B: for ( i = 0; i < 10; i += 1 ) { |
---|
31 | C: for ( i = 0; i < 10; i += 1 ) { |
---|
32 | goto A; |
---|
33 | goto B; |
---|
34 | goto C; |
---|
35 | continue A; |
---|
36 | continue B; |
---|
37 | continue C; |
---|
38 | continue; |
---|
39 | break A; |
---|
40 | break B; |
---|
41 | break C; |
---|
42 | break; |
---|
43 | } |
---|
44 | } |
---|
45 | } |
---|
46 | |
---|
47 | D: for ( ;; ) { |
---|
48 | break D; |
---|
49 | continue D; |
---|
50 | } |
---|
51 | |
---|
52 | Z : i += 1; |
---|
53 | goto Z; |
---|
54 | X: Y: for ( ;; ) { |
---|
55 | i += 1; |
---|
56 | if ( i > 5 ) continue X; |
---|
57 | if ( i < 5 ) break X; |
---|
58 | if ( i < 5 ) break Y; |
---|
59 | break; |
---|
60 | } |
---|
61 | XX: for ( ;; ) { |
---|
62 | YY: for ( ;; ) { |
---|
63 | ZZ: for ( ;; ) { |
---|
64 | i += 1; |
---|
65 | if ( i > 5 ) continue XX; |
---|
66 | if ( i < 5 ) continue YY; |
---|
67 | if ( i < 5 ) continue ZZ; |
---|
68 | if ( i > 5 ) break XX; |
---|
69 | if ( i < 5 ) break YY; |
---|
70 | if ( i < 5 ) break ZZ; |
---|
71 | break; |
---|
72 | } |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | for ( ;; ) ; |
---|
77 | for ( int i = 0 ;; ) ; |
---|
78 | for ( ; i < 0; ) ; |
---|
79 | for ( ; ; i += 1 ) ; |
---|
80 | L0: L1: L2: L3: L4: L5: L6: L7: L8: L9: |
---|
81 | L10: L11: L12: L13: L14: L15: L16: L17: L18: L19: |
---|
82 | L20: L21: L22: L23: L24: L25: L26: L27: L28: L29: |
---|
83 | L31: L32: L33: L34: |
---|
84 | for ( ;; ) { |
---|
85 | break L0; |
---|
86 | } |
---|
87 | |
---|
88 | // switch/choose, labelled exits |
---|
89 | |
---|
90 | Switch: switch ( i ) { |
---|
91 | default: |
---|
92 | i += 1; |
---|
93 | case 0: |
---|
94 | i += 1; |
---|
95 | break Switch; |
---|
96 | case 1: |
---|
97 | switch ( i ) { |
---|
98 | case 0: |
---|
99 | break Switch; |
---|
100 | default: |
---|
101 | break; |
---|
102 | } |
---|
103 | } |
---|
104 | |
---|
105 | Choose: choose ( i ) { |
---|
106 | default: |
---|
107 | i += 1; |
---|
108 | case 0: |
---|
109 | i += 1; |
---|
110 | break Choose; |
---|
111 | case 1: |
---|
112 | choose ( i ) { |
---|
113 | case 0: |
---|
114 | break; |
---|
115 | default: |
---|
116 | break Choose; |
---|
117 | } |
---|
118 | fallthru; |
---|
119 | case 2: |
---|
120 | i += 1; |
---|
121 | } |
---|
122 | #if 0 |
---|
123 | // computed goto |
---|
124 | |
---|
125 | { |
---|
126 | static void *array[] = { &&foo, &&bar, &&hack }; |
---|
127 | |
---|
128 | foo: bar: hack: |
---|
129 | goto *array[i]; |
---|
130 | } |
---|
131 | #endif |
---|
132 | #if 0 |
---|
133 | Q: if ( i > 5 ) { |
---|
134 | i += 1; |
---|
135 | break Q; |
---|
136 | } else |
---|
137 | i += 1; |
---|
138 | #endif |
---|
139 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.