summaryrefslogtreecommitdiff
path: root/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-09-10 15:25:31 -0700
committerGitHub <noreply@github.com>2025-09-10 15:25:31 -0700
commit1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch)
tree57f4b1f313c8cf74eed8819870f39c36ea263c68 /clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp
parent898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff)
parentb8cefcb601ddaa18482555c4ff363c01a270c2fe (diff)
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp')
-rw-r--r--clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp66
1 files changed, 62 insertions, 4 deletions
diff --git a/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp b/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp
index 924d19939d27..9c2f3d941833 100644
--- a/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp
+++ b/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp
@@ -6,8 +6,6 @@ struct CompositeOfScalars {
short J;
char C;
double D;
- _Complex float CF;
- _Complex double CD;
};
struct CompositeHasComposite {
@@ -16,8 +14,6 @@ struct CompositeHasComposite {
short J;
char C;
double D;
- _Complex float CF;
- _Complex double CD;
struct CompositeOfScalars COS; // #COS_FIELD
};
@@ -112,6 +108,68 @@ void uses(unsigned Parm) {
// 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}}
#pragma acc parallel reduction(+:CoCArr[1:1])
while (1);
+
+ int *IPtr;
+ // expected-error@+2{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value, or array of scalars, or composite of scalars}}
+ // 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}}
+#pragma acc parallel reduction(+:IPtr)
+ while (1);
+#pragma acc parallel reduction(+:IPtr[1])
+ while (1);
+#pragma acc parallel reduction(+:IPtr[1:1])
+ while (1);
+
+ int *IPtrArr[5];
+ // expected-error@+3{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value, or array of scalars, or composite of scalars}}
+ // expected-note@+2{{used as element type of array type 'int *'}}
+ // 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}}
+#pragma acc parallel reduction(+:IPtrArr)
+ while (1);
+
+ struct HasPtr { int *I; }; // #HASPTR
+ HasPtr HP;
+ // expected-error@+3{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@#HASPTR{{used as field 'I' of composite 'HasPtr'}}
+ // 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}}
+#pragma acc parallel reduction(+:HP)
+ while (1);
+
+ HasPtr HPArr[5];
+ // expected-error@+4{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of array type 'HasPtr'}}
+ // expected-note@#HASPTR{{used as field 'I' of composite 'HasPtr'}}
+ // 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}}
+#pragma acc parallel reduction(+:HPArr)
+ while (1);
+
+ _Complex int CplxI;
+ _Complex int CplxIArr[5];
+ _Complex float CplxF;
+ _Complex float CplxFArr[5];
+ struct HasCplx { _Complex int I; } HC; //#HASCPLX
+ // expected-error@+2{{invalid type '_Complex int' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // 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}}
+#pragma acc parallel reduction(+:CplxI)
+ while (1);
+ // expected-error@+3{{invalid type '_Complex int' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+2{{used as element type of array type '_Complex int'}}
+ // 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}}
+#pragma acc parallel reduction(+:CplxIArr)
+ while (1);
+ // expected-error@+2{{invalid type '_Complex float' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // 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}}
+#pragma acc parallel reduction(+:CplxF)
+ while (1);
+ // expected-error@+3{{invalid type '_Complex float' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+2{{used as element type of array type '_Complex float'}}
+ // 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}}
+#pragma acc parallel reduction(+:CplxFArr)
+ while (1);
+ // expected-error@+3{{invalid type '_Complex int' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@#HASCPLX{{used as field 'I' of composite 'HasCplx'}}
+ // 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}}
+#pragma acc parallel reduction(+:HC)
+ while (1);
}
template<typename T, typename U, typename V>