Debian Codegraph @

gcc/testsuite/g++.dg/gomp/bad-array-section-9.C

raw
1 // { dg-do compile }
2
3 int x;
4
5 template<typename T>
6 void foo()
7 {
8 T arr1[40];
9 T arr2[40];
10 #pragma omp target map(arr1[arr2[4:5]:arr2[6:7]])
11 // { dg-error {low bound 'arr2\[4:5\]' of array section does not have integral type} "" { target *-*-* } .-1 }
12 { }
13 #pragma omp target map(arr1[arr2[:1]:arr2[6:1]])
14 // { dg-error {low bound 'arr2\[:1\]' of array section does not have integral type} "" { target *-*-* } .-1 }
15 { }
16 #pragma omp target map(arr1[x:arr2[6:1]])
17 // { dg-error {length 'arr2\[6:1\]' of array section does not have integral type} "" { target *-*-* } .-1 }
18 { }
19 }
20
21 int main()
22 {
23 int arr1[40];
24 int arr2[40];
25 #pragma omp target map(arr1[arr2[4:5]:arr2[6:7]])
26 // { dg-error {low bound 'arr2\[4:5\]' of array section does not have integral type} "" { target *-*-* } .-1 }
27 { }
28 #pragma omp target map(arr1[arr2[:1]:arr2[6:1]])
29 // { dg-error {low bound 'arr2\[:1\]' of array section does not have integral type} "" { target *-*-* } .-1 }
30 { }
31 #pragma omp target map(arr1[x:arr2[6:1]])
32 // { dg-error {length 'arr2\[6:1\]' of array section does not have integral type} "" { target *-*-* } .-1 }
33 { }
34
35 foo<int> ();
36
37 return 0;
38 }
39