You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[OpenACC] Make 'reduction' on a complex ill-formed
The standard provides for scalar variables, though is silent as to
whether complex is a scalar variable. However, during review, we found
that it is completely nonsensical to do any of the reduction operations on
complex (or to initialize some), so this patch makes it ill-formed.
Copy file name to clipboardExpand all lines: clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp
+29-4Lines changed: 29 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,6 @@ struct CompositeOfScalars {
6
6
short J;
7
7
char C;
8
8
double D;
9
-
_Complexfloat CF;
10
-
_Complexdouble CD;
11
9
};
12
10
13
11
structCompositeHasComposite {
@@ -16,8 +14,6 @@ struct CompositeHasComposite {
16
14
short J;
17
15
char C;
18
16
double D;
19
-
_Complexfloat CF;
20
-
_Complexdouble CD;
21
17
structCompositeOfScalars COS; // #COS_FIELD
22
18
};
23
19
@@ -145,6 +141,35 @@ void uses(unsigned Parm) {
145
141
// expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
146
142
#pragma acc parallel reduction(+:HPArr)
147
143
while (1);
144
+
145
+
_Complexint CplxI;
146
+
_Complexint CplxIArr[5];
147
+
_Complexfloat CplxF;
148
+
_Complexfloat CplxFArr[5];
149
+
structHasCplx { _Complexint I; } HC; //#HASCPLX
150
+
// expected-error@+2{{invalid type '_Complex int' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
151
+
// expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
152
+
#pragma acc parallel reduction(+:CplxI)
153
+
while (1);
154
+
// expected-error@+3{{invalid type '_Complex int' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
155
+
// expected-note@+2{{used as element type of array type '_Complex int'}}
156
+
// expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
157
+
#pragma acc parallel reduction(+:CplxIArr)
158
+
while (1);
159
+
// expected-error@+2{{invalid type '_Complex float' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
160
+
// expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
161
+
#pragma acc parallel reduction(+:CplxF)
162
+
while (1);
163
+
// expected-error@+3{{invalid type '_Complex float' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
164
+
// expected-note@+2{{used as element type of array type '_Complex float'}}
165
+
// expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
166
+
#pragma acc parallel reduction(+:CplxFArr)
167
+
while (1);
168
+
// expected-error@+3{{invalid type '_Complex int' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
169
+
// expected-note@#HASCPLX{{used as field 'I' of composite 'HasCplx'}}
170
+
// expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
0 commit comments