comparison gcc/testsuite/c-c++-common/goacc/routine-5.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
2 2
3 /* Pragma context. */ 3 /* Pragma context. */
4 4
5 struct PC 5 struct PC
6 { 6 {
7 #pragma acc routine seq /* { dg-error ".#pragma acc routine. must be at file scope" } */ 7 #pragma acc routine /* { dg-error ".#pragma acc routine. must be at file scope" } */
8 }; 8 };
9 9
10 void PC1( /* { dg-bogus "variable or field .PC1. declared void" "TODO" { xfail c++ } } */ 10 void PC1( /* { dg-bogus "variable or field .PC1. declared void" "TODO" { xfail c++ } } */
11 #pragma acc routine seq 11 #pragma acc routine
12 /* { dg-error ".#pragma acc routine. must be at file scope" "" { target c } .-1 } 12 /* { dg-error ".#pragma acc routine. must be at file scope" "" { target c } .-1 }
13 { dg-error ".#pragma. is not allowed here" "" { target c++ } .-2 } */ 13 { dg-error ".#pragma. is not allowed here" "" { target c++ } .-2 } */
14 ) /* { dg-bogus "expected declaration specifiers or .\\.\\.\\.. before .\\). token" "TODO" { xfail c } } */ 14 ) /* { dg-bogus "expected declaration specifiers or .\\.\\.\\.. before .\\). token" "TODO" { xfail c } } */
15 { 15 {
16 } 16 }
17 17
18 void PC2() 18 void PC2()
19 { 19 {
20 if (0) 20 if (0)
21 #pragma acc routine seq /* { dg-error ".#pragma acc routine. must be at file scope" } */ 21 #pragma acc routine /* { dg-error ".#pragma acc routine. must be at file scope" } */
22 ; 22 ;
23 } 23 }
24 24
25 void PC3() 25 void PC3()
26 { 26 {
27 #pragma acc routine seq /* { dg-error ".#pragma acc routine. must be at file scope" } */ 27 #pragma acc routine /* { dg-error ".#pragma acc routine. must be at file scope" } */
28 } 28 }
29 29
30 30
31 /* "( name )" syntax. */ 31 /* "( name )" syntax. */
32 32
33 #pragma acc routine ( /* { dg-error "expected (function name|unqualified-id) before end of line" } */ 33 #pragma acc routine ( /* { dg-error "expected (function name|unqualified-id) before end of line" } */
34 #pragma acc routine () seq /* { dg-error "expected (function name|unqualified-id) before .\\). token" } */ 34 #pragma acc routine () /* { dg-error "expected (function name|unqualified-id) before .\\). token" } */
35 #pragma acc routine (+) seq /* { dg-error "expected (function name|unqualified-id) before .\\+. token" } */ 35 #pragma acc routine (+) /* { dg-error "expected (function name|unqualified-id) before .\\+. token" } */
36 #pragma acc routine (?) seq /* { dg-error "expected (function name|unqualified-id) before .\\?. token" } */ 36 #pragma acc routine (?) /* { dg-error "expected (function name|unqualified-id) before .\\?. token" } */
37 #pragma acc routine (:) seq /* { dg-error "expected (function name|unqualified-id) before .:. token" } */ 37 #pragma acc routine (:) /* { dg-error "expected (function name|unqualified-id) before .:. token" } */
38 #pragma acc routine (4) seq /* { dg-error "expected (function name|unqualified-id) before numeric constant" } */ 38 #pragma acc routine (4) /* { dg-error "expected (function name|unqualified-id) before numeric constant" } */
39 #pragma acc routine ('4') /* { dg-error "expected (function name|unqualified-id) before .4." } */ 39 #pragma acc routine ('4') /* { dg-error "expected (function name|unqualified-id) before .4." } */
40 #pragma acc routine ("4") seq /* { dg-error "expected (function name|unqualified-id) before string constant" } */ 40 #pragma acc routine ("4") /* { dg-error "expected (function name|unqualified-id) before string constant" } */
41 extern void R1(void); 41 extern void R1(void);
42 extern void R2(void); 42 extern void R2(void);
43 #pragma acc routine (R1, R2, R3) worker /* { dg-error "expected .\\). before .,. token" } */ 43 #pragma acc routine (R1, R2, R3) worker /* { dg-error "expected .\\). before .,. token" } */
44 #pragma acc routine (R1 R2 R3) worker /* { dg-error "expected .\\). before .R2." } */ 44 #pragma acc routine (R1 R2 R3) worker /* { dg-error "expected .\\). before .R2." } */
45 #pragma acc routine (R1) worker 45 #pragma acc routine (R1) worker
47 47
48 48
49 /* "#pragma acc routine" not immediately followed by (a single) function 49 /* "#pragma acc routine" not immediately followed by (a single) function
50 declaration or definition. */ 50 declaration or definition. */
51 51
52 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 52 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
53 int a; 53 int a;
54 54
55 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by a single function declaration or definition" } */ 55 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by a single function declaration or definition" } */
56 void fn1 (void), fn1b (void); 56 void fn1 (void), fn1b (void);
57 57
58 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 58 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
59 int b, fn2 (void); 59 int b, fn2 (void);
60 60
61 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 61 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
62 int b_, fn2_ (void), B_; 62 int b_, fn2_ (void), B_;
63 63
64 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by a single function declaration or definition" } */ 64 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by a single function declaration or definition" } */
65 int fn3 (void), b2; 65 int fn3 (void), b2;
66 66
67 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 67 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
68 typedef struct c c; 68 typedef struct c c;
69 69
70 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 70 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
71 struct d {} d; 71 struct d {} d;
72 72
73 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 73 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
74 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by a single function declaration or definition" } */ 74 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by a single function declaration or definition" } */
75 void fn1_2 (void), fn1b_2 (void); 75 void fn1_2 (void), fn1b_2 (void);
76 76
77 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 77 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
78 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 78 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
79 int b_2, fn2_2 (void); 79 int b_2, fn2_2 (void);
80 80
81 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 81 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
82 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 82 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
83 int b_2_, fn2_2_ (void), B_2_; 83 int b_2_, fn2_2_ (void), B_2_;
84 84
85 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 85 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
86 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by a single function declaration or definition" } */ 86 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by a single function declaration or definition" } */
87 int fn3_2 (void), b2_2; 87 int fn3_2 (void), b2_2;
88 88
89 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 89 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
90 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 90 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
91 typedef struct c_2 c_2; 91 typedef struct c_2 c_2;
92 92
93 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 93 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
94 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 94 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
95 struct d_2 {} d_2; 95 struct d_2 {} d_2;
96 96
97 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 97 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
98 #pragma acc routine seq 98 #pragma acc routine
99 int fn4 (void); 99 int fn4 (void);
100 100
101 int fn5a (void); 101 int fn5a (void);
102 int fn5b (void); 102 int fn5b (void);
103 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 103 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
104 #pragma acc routine (fn5a) seq 104 #pragma acc routine (fn5a)
105 #pragma acc routine (fn5b) seq 105 #pragma acc routine (fn5b)
106 int fn5 (void); 106 int fn5 (void);
107 107
108 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 108 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
109 #pragma acc routine (fn6a) seq /* { dg-error ".fn6a. has not been declared" } */ 109 #pragma acc routine (fn6a) /* { dg-error ".fn6a. has not been declared" } */
110 #pragma acc routine (fn6b) seq /* { dg-error ".fn6b. has not been declared" } */ 110 #pragma acc routine (fn6b) /* { dg-error ".fn6b. has not been declared" } */
111 int fn6 (void); 111 int fn6 (void);
112 112
113 #ifdef __cplusplus 113 #ifdef __cplusplus
114 114
115 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" "" { target c++ } } */ 115 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" "" { target c++ } } */
116 namespace f {} 116 namespace f {}
117 117
118 namespace g {} 118 namespace g {}
119 119
120 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" "" { target c++ } } */ 120 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" "" { target c++ } } */
121 using namespace g; 121 using namespace g;
122 122
123 #pragma acc routine (g) seq /* { dg-error ".g. does not refer to a function" "" { target c++ } } */ 123 #pragma acc routine (g) /* { dg-error ".g. does not refer to a function" "" { target c++ } } */
124 124
125 #endif /* __cplusplus */ 125 #endif /* __cplusplus */
126 126
127 #pragma acc routine (a) seq /* { dg-error ".a. does not refer to a function" } */ 127 #pragma acc routine (a) /* { dg-error ".a. does not refer to a function" } */
128 128
129 #pragma acc routine (c) seq /* { dg-error ".c. does not refer to a function" } */ 129 #pragma acc routine (c) /* { dg-error ".c. does not refer to a function" } */
130 130
131 131
132 /* Static assert. */ 132 /* Static assert. */
133 133
134 #pragma acc routine /* { dg-bogus ".#pragma acc routine. not immediately followed by function declaration or definition" "TODO" { xfail *-*-* } } */ 134 #pragma acc routine /* { dg-bogus ".#pragma acc routine. not immediately followed by function declaration or definition" "TODO" { xfail *-*-* } } */
141 #else /* C++ */ 141 #else /* C++ */
142 static_assert(0, ""); /* { dg-error "static assertion failed" "" { target c++11 } } */ 142 static_assert(0, ""); /* { dg-error "static assertion failed" "" { target c++11 } } */
143 #endif 143 #endif
144 void f_static_assert(); 144 void f_static_assert();
145 /* Check that we already recognized "f_static_assert" as an OpenACC routine. */ 145 /* Check that we already recognized "f_static_assert" as an OpenACC routine. */
146 #pragma acc routine (f_static_assert) seq /* { dg-error ".#pragma acc routine. already applied to .\[void \]*f_static_assert" "TODO" { xfail *-*-* } } */ 146 #pragma acc routine (f_static_assert) /* { dg-error ".#pragma acc routine. already applied to .\[void \]*f_static_assert" "TODO" { xfail *-*-* } } */
147 147
148 148
149 /* __extension__ usage. */ 149 /* __extension__ usage. */
150 150
151 #pragma acc routine seq 151 #pragma acc routine
152 __extension__ extern void ex1(); 152 __extension__ extern void ex1();
153 #pragma acc routine (ex1) /* { dg-error ".#pragma acc routine. already applied to .\[void \]*ex1" } */ 153 #pragma acc routine (ex1) worker /* { dg-error "has already been marked with an OpenACC 'routine' directive" } */
154 154
155 #pragma acc routine seq 155 #pragma acc routine
156 __extension__ __extension__ __extension__ __extension__ __extension__ void ex2() 156 __extension__ __extension__ __extension__ __extension__ __extension__ void ex2()
157 { 157 {
158 } 158 }
159 #pragma acc routine (ex2) /* { dg-error ".#pragma acc routine. already applied to .\[void \]*ex2" } */ 159 #pragma acc routine (ex2) worker /* { dg-error "has already been marked with an OpenACC 'routine' directive" } */
160 160
161 #pragma acc routine seq /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */ 161 #pragma acc routine /* { dg-error ".#pragma acc routine. not immediately followed by function declaration or definition" } */
162 __extension__ int ex3; 162 __extension__ int ex3;
163 #pragma acc routine (ex3) seq /* { dg-error ".ex3. does not refer to a function" } */ 163 #pragma acc routine (ex3) /* { dg-error ".ex3. does not refer to a function" } */
164 164
165 165
166 /* "#pragma acc routine" must be applied before. */ 166 /* "#pragma acc routine" must be applied before. */
167 167
168 void Bar (); 168 void Bar ();
170 void Foo () 170 void Foo ()
171 { 171 {
172 Bar (); 172 Bar ();
173 } 173 }
174 174
175 #pragma acc routine (Bar) seq // { dg-error ".#pragma acc routine. must be applied before use" } 175 #pragma acc routine (Bar) // { dg-error ".#pragma acc routine. must be applied before use" }
176 176
177 #pragma acc routine (Foo) gang // { dg-error ".#pragma acc routine. must be applied before definition" } 177 #pragma acc routine (Foo) gang // { dg-error ".#pragma acc routine. must be applied before definition" }
178 178
179 #pragma acc routine (Baz) seq // { dg-error "not been declared" } 179 #pragma acc routine (Baz) // { dg-error "not been declared" }
180 180
181 181
182 /* OpenACC declare. */ 182 /* OpenACC declare. */
183 183
184 int vb1; /* { dg-error "directive for use" } */ 184 int vb1; /* { dg-error "directive for use" } */
185 extern int vb2; /* { dg-error "directive for use" } */ 185 extern int vb2; /* { dg-error "directive for use" } */
186 static int vb3; /* { dg-error "directive for use" } */ 186 static int vb3; /* { dg-error "directive for use" } */
187 187
188 #pragma acc routine seq 188 #pragma acc routine
189 int 189 int
190 func1 (int a) 190 func1 (int a)
191 { 191 {
192 vb1 = a + 1; 192 vb1 = a + 1;
193 vb2 = vb1 + 1; 193 vb2 = vb1 + 1;
194 vb3 = vb2 + 1; 194 vb3 = vb2 + 1;
195 195
196 return vb3; 196 return vb3;
197 } 197 }
198 198
199 #pragma acc routine seq 199 #pragma acc routine
200 int 200 int
201 func2 (int a) 201 func2 (int a)
202 { 202 {
203 extern int vb4; /* { dg-error "directive for use" } */ 203 extern int vb4; /* { dg-error "directive for use" } */
204 static int vb5; /* { dg-error "directive for use" } */ 204 static int vb5;
205 205
206 vb4 = a + 1; 206 vb4 = a + 1;
207 vb5 = vb4 + 1; 207 vb5 = vb4 + 1;
208 208
209 return vb5; 209 return vb5;
212 extern int vb6; /* { dg-error "clause used in" } */ 212 extern int vb6; /* { dg-error "clause used in" } */
213 #pragma acc declare link (vb6) 213 #pragma acc declare link (vb6)
214 static int vb7; /* { dg-error "clause used in" } */ 214 static int vb7; /* { dg-error "clause used in" } */
215 #pragma acc declare link (vb7) 215 #pragma acc declare link (vb7)
216 216
217 #pragma acc routine seq 217 #pragma acc routine
218 int 218 int
219 func3 (int a) 219 func3 (int a)
220 { 220 {
221 vb6 = a + 1; 221 vb6 = a + 1;
222 vb7 = vb6 + 1; 222 vb7 = vb6 + 1;
229 extern int vb9; 229 extern int vb9;
230 #pragma acc declare create (vb9) 230 #pragma acc declare create (vb9)
231 static int vb10; 231 static int vb10;
232 #pragma acc declare create (vb10) 232 #pragma acc declare create (vb10)
233 233
234 #pragma acc routine seq 234 #pragma acc routine
235 int 235 int
236 func4 (int a) 236 func4 (int a)
237 { 237 {
238 vb8 = a + 1; 238 vb8 = a + 1;
239 vb9 = vb8 + 1; 239 vb9 = vb8 + 1;
247 extern int vb12; 247 extern int vb12;
248 #pragma acc declare device_resident (vb12) 248 #pragma acc declare device_resident (vb12)
249 extern int vb13; 249 extern int vb13;
250 #pragma acc declare device_resident (vb13) 250 #pragma acc declare device_resident (vb13)
251 251
252 #pragma acc routine seq 252 #pragma acc routine
253 int 253 int
254 func5 (int a) 254 func5 (int a)
255 { 255 {
256 vb11 = a + 1; 256 vb11 = a + 1;
257 vb12 = vb11 + 1; 257 vb12 = vb11 + 1;
258 vb13 = vb12 + 1; 258 vb13 = vb12 + 1;
259 259
260 return vb13; 260 return vb13;
261 } 261 }
262 262
263 #pragma acc routine seq 263 #pragma acc routine
264 int 264 int
265 func6 (int a) 265 func6 (int a)
266 { 266 {
267 extern int vb14; 267 extern int vb14;
268 #pragma acc declare create (vb14) 268 #pragma acc declare create (vb14)