Debian Codegraph @

gcc/testsuite/g++.dg/gomp/attrs-imperfect2.C

raw
1 /* { dg-do compile { target c++11 } } */
2
3 /* This test case is expected to fail due to errors. */
4
5 /* These functions that are part of the OpenMP runtime API would ordinarily
6 be declared in omp.h, but we don't have that here. */
7 extern int omp_get_num_threads(void);
8 extern int omp_get_max_threads(void);
9
10 int f1 (int depth, int iter);
11 int f2 (int depth, int iter);
12
13 void s1 (int a1, int a2, int a3)
14 {
15 int i, j, k;
16 [[ omp :: directive (for, collapse(3)) ]]
17 for (i = 0; i < a1; i++)
18 {
19 f1 (0, i);
20 for (j = 0; j < omp_get_num_threads (); j++) /* This is OK */
21 {
22 f1 (1, omp_get_num_threads ()); /* { dg-error "not permitted in intervening code" } */
23 for (k = omp_get_num_threads (); k < a3; k++) /* This is OK */
24 {
25 f1 (2, omp_get_num_threads ());
26 f2 (2, omp_get_max_threads ());
27 }
28 f2 (1, omp_get_max_threads ()); /* { dg-error "not permitted in intervening code" } */
29 }
30 f2 (0, i);
31 }
32 }
33
34