Debian Codegraph @

gcc/testsuite/g++.dg/gomp/tpl-imperfect-gotos.C

raw
1 /* { dg-do compile } */
2
3 /* This file contains tests that are expected to fail. */
4
5
6 /* These jumps are all OK since they are to/from the same structured block. */
7
8 template<typename T>
9 void f1a (void)
10 {
11 #pragma omp for collapse(2)
12 for (T i = 0; i < 64; ++i)
13 {
14 goto a; a:;
15 for (T j = 0; j < 64; ++j)
16 {
17 goto c; c:;
18 }
19 goto b; b:;
20 }
21 }
22
23 /* Jump around loop body to/from different structured blocks of intervening
24 code. */
25 template<typename T>
26 void f2a (void)
27 {
28 #pragma omp for collapse(2)
29 for (T i = 0; i < 64; ++i)
30 {
31 goto a; a:;
32 if (i > 16) goto b; /* { dg-error "invalid branch to/from OpenMP structured block" } */
33 for (T j = 0; j < 64; ++j)
34 {
35 goto c; c:;
36 }
37 goto b; b:;
38 }
39 }
40
41 /* Jump into loop body from intervening code. */
42 template<typename T>
43 void f3a (void)
44 {
45 #pragma omp for collapse(2)
46 for (T i = 0; i < 64; ++i)
47 {
48 goto a; a:;
49 if (i > 16) goto c; /* { dg-error "invalid branch to/from OpenMP structured block" } */
50 for (T j = 0; j < 64; ++j)
51 {
52 c: /* { dg-error "jump to label .c." } */
53 ;
54 }
55 goto b; b:;
56 }
57 }
58
59 /* Jump out of loop body to intervening code. */
60 template<typename T>
61 void f4a (void)
62 {
63 #pragma omp for collapse(2)
64 for (T i = 0; i < 64; ++i)
65 {
66 goto a; a:;
67 for (T j = 0; j < 64; ++j)
68 if (i > 16) goto c; /* { dg-error "invalid branch to/from OpenMP structured block" } */
69 c:
70 ;
71 goto b; b:;
72 }
73 }
74
75 /* The next group of tests use the GNU extension for local labels. Expected
76 behavior is the same as the above group. */
77
78 /* These jumps are all OK since they are to/from the same structured block. */
79
80 template<typename T>
81 void f1b (void)
82 {
83 #pragma omp for collapse(2)
84 for (T i = 0; i < 64; ++i)
85 {
86 __label__ a, b, c;
87 goto a; a:;
88 for (T j = 0; j < 64; ++j)
89 {
90 goto c; c:;
91 }
92 goto b; b:;
93 }
94 }
95
96 /* Jump around loop body to/from different structured blocks of intervening
97 code. */
98 template<typename T>
99 void f2b (void)
100 {
101 #pragma omp for collapse(2)
102 for (T i = 0; i < 64; ++i)
103 {
104 __label__ a, b, c;
105 goto a; a:;
106 if (i > 16) goto b; /* { dg-error "invalid branch to/from OpenMP structured block" } */
107 for (T j = 0; j < 64; ++j)
108 {
109 goto c; c:;
110 }
111 goto b; b:;
112 }
113 }
114
115 /* Jump into loop body from intervening code. */
116 template<typename T>
117 void f3b (void)
118 {
119 #pragma omp for collapse(2)
120 for (T i = 0; i < 64; ++i)
121 {
122 __label__ a, b, c;
123 goto a; a:;
124 if (i > 16) goto c; /* { dg-error "invalid branch to/from OpenMP structured block" } */
125 for (T j = 0; j < 64; ++j)
126 {
127 c: /* { dg-error "jump to label .c." } */
128 ;
129 }
130 goto b; b:;
131 }
132 }
133
134 /* Jump out of loop body to intervening code. */
135 template<typename T>
136 void f4b (void)
137 {
138 #pragma omp for collapse(2)
139 for (T i = 0; i < 64; ++i)
140 {
141 __label__ a, b, c;
142 goto a; a:;
143 for (T j = 0; j < 64; ++j)
144 if (i > 16) goto c; /* { dg-error "invalid branch to/from OpenMP structured block" } */
145 c:
146 ;
147 goto b; b:;
148 }
149 }
150
151 int main (void)
152 {
153 f1a<int> ();
154 f2a<int> ();
155 f3a<int> ();
156 f4a<int> ();
157 f1b<int> ();
158 f2b<int> ();
159 f3b<int> ();
160 f4b<int> ();
161 }