]>
gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/c-c++-common/gomp/map-1.c
1 /* Test 'map' clause diagnostics. */
3 /* See also corresponding OpenMP C++ variant: '../../g++.dg/gomp/map-1.C'. */
5 /* See also corresponding OpenACC variant: '../goacc/data-clause-1.c'. */
7 extern int a
[][10], a2
[][10];
8 int b
[10], c
[10][2], d
[10], e
[10], f
[10];
9 int b2
[10], c2
[10][2], d2
[10], e2
[10], f2
[10];
10 int k
[10], l
[10], m
[10], n
[10], o
;
15 extern struct s s2
[1]; /* { dg-error "array type has incomplete element type" "" { target c } } */
17 #pragma omp threadprivate (t)
18 #pragma omp declare target
20 #pragma omp end declare target
23 foo (int g
[3][10], int h
[4][8], int i
[2][10], int j
[][9],
24 int g2
[3][10], int h2
[4][8], int i2
[2][10], int j2
[][9])
26 #pragma omp target map(to: bar[2:5]) /* { dg-error "is not a variable" } */
28 #pragma omp target map(from: t[2:5]) /* { dg-error "is threadprivate variable" } */
30 #pragma omp target map(tofrom: k[0.5:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
32 #pragma omp target map(from: l[:7.5f]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
34 #pragma omp target map(to: m[p:]) /* { dg-error "low bound \[^\n\r]* of array section does not have integral type" } */
36 #pragma omp target map(tofrom: n[:p]) /* { dg-error "length \[^\n\r]* of array section does not have integral type" } */
38 #pragma omp target map(to: o[2:5]) /* { dg-error "does not have pointer or array type" } */
40 #pragma omp target map(alloc: s1) /* { dg-error "'s1' does not have a mappable type in 'map' clause" } */
42 #pragma omp target map(alloc: s2) /* { dg-error "'s2' does not have a mappable type in 'map' clause" } */
44 #pragma omp target map(to: a[:][:]) /* { dg-error "array type length expression must be specified" } */
45 bar (&a
[0][0]); /* { dg-error "referenced in target region does not have a mappable type" } */
46 #pragma omp target map(tofrom: b[-1:]) /* { dg-error "negative low bound in array section" } */
48 #pragma omp target map(tofrom: c[:-3][:]) /* { dg-error "negative length in array section" } */
50 #pragma omp target map(from: d[11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
52 #pragma omp target map(to: e[:11]) /* { dg-error "length \[^\n\r]* above array section size" } */
54 #pragma omp target map(to: f[1:10]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
56 #pragma omp target map(from: g[:][0:10]) /* { dg-error "for array function parameter length expression must be specified" } */
58 #pragma omp target map(from: h[2:1][-1:]) /* { dg-error "negative low bound in array section" } */
60 #pragma omp target map(tofrom: h[:1][:-3]) /* { dg-error "negative length in array section" } */
62 #pragma omp target map(i[:1][11:]) /* { dg-error "low bound \[^\n\r]* above array section size" } */
64 #pragma omp target map(from: j[3:1][:10]) /* { dg-error "length \[^\n\r]* above array section size" } */
66 #pragma omp target map(to: j[30:1][5:5]) /* { dg-error "high bound \[^\n\r]* above array section size" } */
68 #pragma omp target map(to: a2[:1][2:4])
70 #pragma omp target map(a2[3:5][:])
72 #pragma omp target map(to: a2[3:5][:10])
74 #pragma omp target map(tofrom: b2[0:])
76 #pragma omp target map(tofrom: c2[:3][:])
78 #pragma omp target map(from: d2[9:])
80 #pragma omp target map(to: e2[:10])
82 #pragma omp target map(to: f2[1:9])
84 #pragma omp target map(g2[:1][2:4])
86 #pragma omp target map(from: h2[2:2][0:])
88 #pragma omp target map(tofrom: h2[:1][:3])
90 #pragma omp target map(to: i2[:1][9:])
92 #pragma omp target map(from: j2[3:4][:9])
94 #pragma omp target map(to: j2[30:1][5:4])
96 #pragma omp target map(q[1:2])
98 #pragma omp target map(tofrom: q[3:5][:10]) /* { dg-error "array section is not contiguous" } */
100 #pragma omp target map(r[3:][2:1][1:2])
102 #pragma omp target map(r[3:][2:1][1:2][:][0:4])
104 #pragma omp target map(r[3:][2:1][1:2][1:][0:4]) /* { dg-error "array section is not contiguous" } */
106 #pragma omp target map(r[3:][2:1][1:2][:3][0:4]) /* { dg-error "array section is not contiguous" } */
108 #pragma omp target map(r[3:][2:1][1:2][:][1:]) /* { dg-error "array section is not contiguous" } */
110 #pragma omp target map(r[3:][2:1][1:2][:][:3]) /* { dg-error "array section is not contiguous" } */
This page took 0.045537 seconds and 5 git commands to generate.