1 /* { dg-do compile } */
2 /* { dg-options "-fopenmp" } */
4 extern int a
[][10], a2
[][10];
5 int b
[10], c
[10][2], d
[10], e
[10], f
[10];
6 int b2
[10], c2
[10][2], d2
[10], e2
[10], f2
[10];
7 int k
[10], l
[10], m
[10], n
[10], o
;
11 #pragma omp threadprivate (t)
14 foo (int g
[3][10], int h
[4][8], int i
[2][10], int j
[][9],
15 int g2
[3][10], int h2
[4][8], int i2
[2][10], int j2
[][9])
17 #pragma omp task affinity( bar[2:5]) /* { dg-error "is not a variable" } */
19 #pragma omp task affinity( t[2:5])
21 #pragma omp task affinity( k[0.5:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
23 #pragma omp task affinity( l[:7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
25 #pragma omp task affinity( m[p:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
27 #pragma omp task affinity( n[:p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
29 #pragma omp task affinity( o[2:5]) /* { dg-error "does not have pointer or array type" } */
31 #pragma omp task affinity( a[:][2:4]) /* { dg-error "array type length expression must be specified" } */
33 #pragma omp task affinity( b[-1:]) /* { dg-error "negative low bound in array section" } */
35 #pragma omp task affinity( c[:-3][1:1]) /* { dg-error "negative length in array section" } */
37 #pragma omp task affinity( d[11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
39 #pragma omp task affinity( e[:11]) /* { dg-error "length \[^\n\r]* above array section size" } */
41 #pragma omp task affinity( f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
43 #pragma omp task affinity( g[:][2:4]) /* { dg-error "for array function parameter length expression must be specified" } */
45 #pragma omp task affinity( h[2:2][-1:]) /* { dg-error "negative low bound in array section" } */
47 #pragma omp task affinity( h[:1][:-3]) /* { dg-error "negative length in array section" } */
49 #pragma omp task affinity( i[:1][11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
51 #pragma omp task affinity( j[3:4][:10]) /* { dg-error "length \[^\n\r]* above array section size" } */
53 #pragma omp task affinity( j[30:10][5:5]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
55 #pragma omp task affinity( a2[:3][2:4])
57 #pragma omp task affinity( b2[0:])
59 #pragma omp task affinity( c2[:3][1:1])
61 #pragma omp task affinity( d2[9:])
63 #pragma omp task affinity( e2[:10])
65 #pragma omp task affinity( f2[1:9])
67 #pragma omp task affinity( g2[:2][2:4])
69 #pragma omp task affinity( h2[2:2][0:])
71 #pragma omp task affinity( h2[:1][:3])
73 #pragma omp task affinity( i2[:1][9:])
75 #pragma omp task affinity( j2[3:4][:9])
77 #pragma omp task affinity( j2[30:10][5:4])
81 void bar2 (int a
[10][10][10]);
84 foo2 (int a
[10][10][10], int **b
)
87 #pragma omp task affinity( a[2:4][3:][:7], b[1:7][2:8])
89 int i
= 1, j
= 3, k
= 2, l
= 6;
90 #pragma omp task affinity( a[++i:++j][++k:][:++l])
92 #pragma omp task affinity( a[7:2][:][:], c[5:2][:][:])
100 foo3 (int a
[10][10][10], int **b
, int x
)
103 #pragma omp task affinity( a[2:4][3:0][:7]) /* { dg-error "zero length array section" } */
105 #pragma omp task affinity( b[:7][0:0][:0]) /* { dg-error "zero length array section" } */
107 #pragma omp task affinity( c[:][:][10:]) /* { dg-error "zero length array section" } */
109 #pragma omp task affinity( a[2:4][3:0][:x]) /* { dg-error "zero length array section" } */
111 #pragma omp task affinity( b[:x][0:0][:0]) /* { dg-error "zero length array section" } */
113 #pragma omp task affinity( c[:][x-2:x][10:]) /* { dg-error "zero length array section" } */
118 foo4 (int *p
, int (*q
)[10], int r
[10], int s
[10][10])
120 int a
[10], b
[10][10];
121 #pragma omp task affinity ( p[-1:2])
123 #pragma omp task affinity ( q[-1:2][2:4])
125 #pragma omp task affinity ( q[-1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */
127 #pragma omp task affinity ( r[-1:2])
129 #pragma omp task affinity ( s[-1:2][2:4])
131 #pragma omp task affinity ( s[-1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */
133 #pragma omp task affinity ( a[-1:2]) /* { dg-error "negative low bound in array section in" } */
135 #pragma omp task affinity ( b[-1:2][2:4]) /* { dg-error "negative low bound in array section in" } */
137 #pragma omp task affinity ( b[1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */
139 #pragma omp task affinity ( p[2:-3]) /* { dg-error "negative length in array section in" } */
141 #pragma omp task affinity ( q[2:-3][:]) /* { dg-error "negative length in array section in" } */
143 #pragma omp task affinity ( q[2:3][0:-1]) /* { dg-error "negative length in array section in" } */
145 #pragma omp task affinity ( r[2:-5]) /* { dg-error "negative length in array section in" } */
147 #pragma omp task affinity ( s[2:-5][:]) /* { dg-error "negative length in array section in" } */
149 #pragma omp task affinity ( s[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
151 #pragma omp task affinity ( a[2:-5]) /* { dg-error "negative length in array section in" } */
153 #pragma omp task affinity ( b[2:-5][0:10]) /* { dg-error "negative length in array section in" } */
155 #pragma omp task affinity ( b[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
159 struct T
{ int c
[3]; };
160 struct S
{ int a
; struct T
*b
; struct T g
; };
165 struct U
{ int a
: 5; };
172 #pragma omp task affinity( sd)
174 #pragma omp task affinity( sd[2])
176 #pragma omp task affinity( sd[:])
178 #pragma omp task affinity( sd[2:2])
180 #pragma omp task affinity( sd[:2])
182 #pragma omp task affinity( sd[1].b->c[2])
184 #pragma omp task affinity( sd[0].a)
186 #pragma omp task affinity( se[3]->a)
188 #pragma omp task affinity( se[2]->b->c)
190 #pragma omp task affinity( se[1]->b->c[2])
192 #pragma omp task affinity( (*sf).a)
194 #pragma omp task affinity( sf->b->c[0])
196 #pragma omp task affinity( sf)
198 #pragma omp task affinity( *sf)
200 #pragma omp task affinity( sf[0])
202 #pragma omp task affinity( sf[0].a)
204 #pragma omp task affinity( sh.g.c[2])
211 #pragma omp task affinity( sd[:2].b->c[2]) /* { dg-error "expected" } */
213 #pragma omp task affinity( sd[1:].b->c[2]) /* { dg-error "expected" } */
215 #pragma omp task affinity( sd[0:1].a) /* { dg-error "expected" } */
217 #pragma omp task affinity( se[3:2]->a) /* { dg-error "expected" } */
219 #pragma omp task affinity( se[2:2]->b->c) /* { dg-error "expected" } */
221 #pragma omp task affinity( se[1]->b->c[2:1]) /* { dg-error "expected" } */
223 #pragma omp task affinity( sf + 0) /* { dg-error "'sf' is not lvalue expression nor array section in 'affinity' clause" } */
225 #pragma omp task affinity( sf[0:1].a) /* { dg-error "expected" } */
227 #pragma omp task affinity( sh.g.c[2:1]) /* { dg-error "expected" } */
229 #pragma omp task affinity( si.a) /* { dg-error "bit-field 'si\\..*a' in 'affinity' clause" } */
232 /* { dg-additional-options "-Wno-volatile" { target c++ } } */