Debian Codegraph @

gcc/testsuite/c-c++-common/goacc/pr92793-1.c

raw
1 /* Verify column location information. */
2
3 /* See also 'gfortran.dg/goacc/pr92793-1.f90'. */
4
5 /* { dg-additional-options "-fdump-tree-original-lineno" }
6 { dg-additional-options "-fdump-tree-gimple-lineno" } */
7
8 /* No tabs. Funny indentation/spacing for a reason. */
9
10
11 static void
12 check ()
13 {
14 int i, j, sum, diff;
15
16 #pragma acc parallel \
17 /* C, C++ location information points to the 'a' in '#pragma acc parallel'. */ \
18 /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:16:12\\\] #pragma acc parallel" 1 "original" } } */ \
19 /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:16:12\\\] #pragma omp target oacc_parallel" 1 "gimple" } } */
20 {
21 #pragma acc loop \
22 /* C, C++ location information points to the 'a' in '#pragma acc loop'. */ \
23 /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:21:13\\\] #pragma acc loop" 1 "original" } } */ \
24 /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:21:13\\\] #pragma acc loop" 1 "gimple" } } */ \
25 reduction ( + : sum) /* { dg-line sum1 } */ \
26 /* C location information points to the '(' in 'reduction(+:sum)'. */ \
27 /* { dg-message "19: location of the previous reduction for 'sum'" "" { target c } sum1 } */ \
28 /* C++ location information points to 'sum' in 'reduction(+:sum)'. */ \
29 /* { dg-message "28: location of the previous reduction for 'sum'" "" { target c++ } sum1 } */ \
30 independent
31 for (i = 1; i <= 10; i++)
32 {
33 #pragma acc loop \
34 /* C, C++ location information points to the 'a' in '#pragma acc loop'. */ \
35 /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:33:19\\\] #pragma acc loop" 1 "original" } } */ \
36 /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:33:19\\\] #pragma acc loop" 1 "gimple" } } */ \
37 reduction ( - : diff ) \
38 reduction(-:sum ) /* { dg-line sum2 } */ \
39 /* C location information points to the '(' in 'reduction(-:sum)'. */ \
40 /* { dg-warning "10: conflicting reduction operations for 'sum'" "" { target c } sum2 } */ \
41 /* C++ location information points to 'sum' in 'reduction(-:sum)'. */ \
42 /* { dg-warning "13: conflicting reduction operations for 'sum'" "" { target c++ } sum2 } */ \
43 independent
44 for (j = 1; j <= 10; j++)
45 {
46 sum
47 =
48 1 ;
49 /* C, C++ location information points to the '=' in 'sum = 1'. */ \
50 /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:47:19\\\] sum = 1" 1 "original" } } */ \
51 /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:47:19\\\] sum = 1" 1 "gimple" } } */
52 }
53 }
54 }
55 }
56
57
58 void
59 gwv_sl_1() {
60 #pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */ \
61 gang(num:5) /* { dg-error "5: argument not permitted on 'gang' clause" } */ \
62 worker(num:5) /* { dg-error "3: argument not permitted on 'worker' clause" } */ \
63 vector(length:5) /* { dg-error "4: argument not permitted on 'vector' clause" } */
64 for (int i = 0; i < 10; i++)
65 ;
66 }
67
68 void
69 gwv_sl_2() {
70 #pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */
71 for (int i = 0; i < 10; i++)
72 {
73 #pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
74 for (int j = 0; j < 10; j++)
75 {
76 #pragma acc loop \
77 gang(num:5) /* { dg-error "9: argument not permitted on 'gang' clause" } */ \
78 worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
79 vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
80 for (int k = 0; k < 10; k++)
81 ;
82 }
83 }
84 }
85
86 void
87 gwv_s_l() {
88 #pragma acc serial /* { dg-message "9: enclosing parent compute construct" } */
89 {
90 #pragma acc loop \
91 gang(num:5) /* { dg-error "8: argument not permitted on 'gang' clause" } */ \
92 worker(num:5) /* { dg-error "4: argument not permitted on 'worker' clause" } */ \
93 vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
94 for (int i = 0; i < 10; i++)
95 ;
96
97 #pragma acc loop
98 for (int i = 0; i < 10; i++)
99 {
100 #pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
101 for (int j = 0; j < 10; j++)
102 {
103 #pragma acc loop \
104 gang(num:5) /* { dg-error "10: argument not permitted on 'gang' clause" } */ \
105 worker(num:5) /* { dg-error "7: argument not permitted on 'worker' clause" } */ \
106 vector(length:5) /* { dg-error "5: argument not permitted on 'vector' clause" } */
107 for (int k = 0; k < 10; k++)
108 ;
109 }
110 }
111 }
112 }
113
114 void gwv_r();
115 #pragma acc routine(gwv_r)
116
117 void
118 gwv_r() { /* { dg-message "1: enclosing routine" } */
119 #pragma acc loop \
120 gang(num:5) /* { dg-error "4: argument not permitted on 'gang' clause" } */ \
121 worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
122 vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
123 for (int i = 0; i < 10; i++)
124 ;
125
126 #pragma acc loop
127 for (int i = 0; i < 10; i++)
128 {
129 #pragma acc loop
130 for (int j = 0; j < 10; j++)
131 {
132 #pragma acc loop \
133 gang(num:5) /* { dg-error "6: argument not permitted on 'gang' clause" } */ \
134 worker(num:5) /* { dg-error "4: argument not permitted on 'worker' clause" } */ \
135 vector(length:5) /* { dg-error "6: argument not permitted on 'vector' clause" } */
136 for (int k = 0; k < 10; k++)
137 ;
138 }
139 }
140 }