1 /* { dg-do compile } */
2 /* { dg-require-effective-target tls } */
3 
4 #define p parallel
5 
6 extern void bar (void);
7 extern char q[];
8 int t;
9 #pragma omp threadprivate (t)
10 
11 void
foo(int x)12 foo (int x)
13 {
14   char *pp;
15   struct S { int i; int j; } s;
16   char a[32];
17   double d;
18   int i;
19   const int c = 8;
20 #pragma omp p shared (x, x) /* { dg-error "more than once" } */
21     ;
22 #pragma omp p private (x) private (x) /* { dg-error "more than once" } */
23     ;
24 #pragma omp p shared (x) firstprivate (x) /* { dg-error "more than once" } */
25     ;
26 #pragma omp p firstprivate (x, x) /* { dg-error "more than once" } */
27     ;
28 #pragma omp p for shared (x) lastprivate (x) /* { dg-error "more than" } */
29   for (i = 0; i < 10; i++)
30     ;
31 #pragma omp p for private (x) lastprivate (x) /* { dg-error "more than" } */
32   for (i = 0; i < 10; i++)
33     ;
34 #pragma omp p for lastprivate (x, x) /* { dg-error "more than once" } */
35   for (i = 0; i < 10; i++)
36     ;
37 #pragma omp p for linear (x, x) /* { dg-error "more than once" } */
38   for (i = 0; i < 10; i++)
39     ;
40 #pragma omp single private (x) copyprivate (x) /* { dg-error "more than" } */
41     ;
42 #pragma omp p shared (bar) /* { dg-error "is not a variable" } */
43     ;
44 #pragma omp p private (bar) /* { dg-error "is not a variable" } */
45     ;
46 #pragma omp p firstprivate (bar) /* { dg-error "is not a variable" } */
47     ;
48 #pragma omp p reduction (+:pp) /* { dg-error "user defined reduction not found for" } */
49     ;
50 #pragma omp p reduction (*:s) /* { dg-error "user defined reduction not found for" } */
51     ;
52 #pragma omp p reduction (-:a)
53     ;
54   d = 0;
55 #pragma omp p reduction (*:d)
56     ;
57 #pragma omp p reduction (|:d) /* { dg-error "has invalid type for" } */
58     ;
59 #pragma omp p reduction (&:d) /* { dg-error "has invalid type for" } */
60     ;
61 #pragma omp p copyin (d) /* { dg-error "must be 'threadprivate'" } */
62     ;
63 #pragma omp p copyin (x) /* { dg-error "must be 'threadprivate'" } */
64     ;
65 #pragma omp p for firstprivate (x) lastprivate (x)
66   for (i = 0; i < 10; i++)
67     ;
68 #pragma omp p private (q) /* { dg-error "incomplete type" } */
69     ;
70 #pragma omp p firstprivate (q) /* { dg-error "incomplete type" } */
71     ;
72 #pragma omp p for lastprivate (q) /* { dg-error "incomplete type" } */
73   for (i = 0; i < 10; i++)
74     ;
75 #pragma omp p shared (t) /* { dg-error "predetermined 'threadprivate'" } */
76     ;
77 #pragma omp p private (t) /* { dg-error "predetermined 'threadprivate'" } */
78     ;
79 #pragma omp p firstprivate (t) /* { dg-error "predetermined 'threadpriv" } */
80     ;
81 #pragma omp p for lastprivate (t) /* { dg-error "predetermined 'threadpr" } */
82   for (i = 0; i < 10; i++)
83     ;
84 #pragma omp p reduction (*:t) /* { dg-error "predetermined 'threadprivate" } */
85     ;
86 #pragma omp p for linear (t) /* { dg-error "predetermined 'threadprivate" } */
87   for (i = 0; i < 10; i++)
88     ;
89 #pragma omp p shared (c)
90     ;
91 #pragma omp p private (c) /* { dg-error "'const' qualified 'c' may appear only in 'shared' or 'firstprivate' clauses" } */
92     ;
93 #pragma omp p firstprivate (c)
94     ;
95 #pragma omp p for lastprivate (c) /* { dg-error "'const' qualified 'c' may appear only in 'shared' or 'firstprivate' clauses" } */
96   for (i = 0; i < 10; i++)
97     ;
98 #pragma omp p reduction (*:c) /* { dg-error "'const' qualified 'c' may appear only in 'shared' or 'firstprivate' clauses" } */
99     ;
100 #pragma omp p for linear (c) /* { dg-error "'const' qualified 'c' may appear only in 'shared' or 'firstprivate' clauses" } */
101   for (i = 0; i < 10; i++)
102     ;
103 }
104