diff options
Diffstat (limited to 'clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp')
-rw-r--r-- | clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp | 76 |
1 files changed, 66 insertions, 10 deletions
diff --git a/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp b/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp index 9c2f3d9..e3a487a 100644 --- a/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp +++ b/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp @@ -2,7 +2,7 @@ struct CompositeOfScalars { int I; - float F; + float F; // #COS_FLOAT short J; char C; double D; @@ -61,6 +61,11 @@ void uses(unsigned Parm) { // Vars in a reduction must be a scalar or a composite of scalars. #pragma acc parallel reduction(&: CoS, I, F) + // expected-error@-1{{variable of type 'float' referenced in OpenACC 'reduction' clause does not have a valid operation available}} + // expected-error@-2{{invalid operands to binary expression ('float' and 'float')}} + // expected-error@-3{{variable of type 'float' referenced in OpenACC 'reduction' clause does not have a valid operation available}} + // expected-note@#COS_FLOAT{{while forming combiner for compound type 'CompositeOfScalars'}} + // expected-error@-5{{invalid operands to binary expression ('float' and 'float')}} while (1); // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} @@ -71,6 +76,9 @@ void uses(unsigned Parm) { while (1); #pragma acc parallel reduction(&: CoS, Array[I], Array[0:I]) + // expected-error@-1{{variable of type 'float' referenced in OpenACC 'reduction' clause does not have a valid operation available}} + // expected-note@#COS_FLOAT{{while forming combiner for compound type 'CompositeOfScalars'}} + // expected-error@-3{{invalid operands to binary expression ('float' and 'float')}} while (1); // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, or composite variable member}} @@ -91,19 +99,17 @@ void uses(unsigned Parm) { CompositeHasComposite CoCArr[5]; // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of array type 'CompositeHasComposite'}} + // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // 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) while (1); - // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}} + // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // 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[3]) while (1); - // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} - // expected-note@+3{{used as element type of sub-array type 'CompositeHasComposite'}} + // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} // 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]) @@ -121,7 +127,7 @@ void uses(unsigned Parm) { 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@+2{{used as element type of array type 'int *[5]'}} // 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); @@ -136,7 +142,7 @@ void uses(unsigned Parm) { 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@+3{{used as element type of array type 'HasPtr[5]'}} // 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) @@ -152,7 +158,7 @@ void uses(unsigned Parm) { #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@+2{{used as element type of array type '_Complex int[5]'}} // 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); @@ -161,7 +167,7 @@ void uses(unsigned Parm) { #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@+2{{used as element type of array type '_Complex float[5]'}} // 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); @@ -213,6 +219,9 @@ void TemplUses(T Parm, U CoS, V ChC) { // Vars in a reduction must be a scalar or a composite of scalars. #pragma acc parallel reduction(&: CoS, Var, Parm) + // expected-error@-1{{variable of type 'float' referenced in OpenACC 'reduction' clause does not have a valid operation available}} + // expected-note@#COS_FLOAT{{while forming combiner for compound type 'CompositeOfScalars'}} + // expected-error@-3{{invalid operands to binary expression ('float' and 'float')}} while (1); // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}} // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}} @@ -225,6 +234,9 @@ void TemplUses(T Parm, U CoS, V ChC) { while (1); #pragma acc parallel reduction(&: CoS, Array[Var], Array[0:Var]) + // expected-error@-1{{variable of type 'float' referenced in OpenACC 'reduction' clause does not have a valid operation available}} + // expected-note@#COS_FLOAT{{while forming combiner for compound type 'CompositeOfScalars'}} + // expected-error@-3{{invalid operands to binary expression ('float' and 'float')}} while (1); // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, or composite variable member}} @@ -242,6 +254,50 @@ void TemplUses(T Parm, U CoS, V ChC) { // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, or composite variable member}} #pragma acc parallel reduction(&: ChCPtr->COS) while (1); + + T ThreeDArray[3][4][5]; + + // expected-error@+3{{invalid type 'int[4][5]' used in OpenACC 'reduction' variable reference; type is not a scalar value}} + // expected-note@+2{{used as element type of array type 'int[3][4][5]'}} + // 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(+:ThreeDArray) + while (1); + // expected-error@+3{{invalid type 'int[5]' used in OpenACC 'reduction' variable reference; type is not a scalar value}} + // expected-note@+2{{used as element type of array type 'int[4][5]'}} + // 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(+:ThreeDArray[1:1]) + while (1); + // expected-error@+3{{invalid type 'int[5]' used in OpenACC 'reduction' variable reference; type is not a scalar value}} + // expected-note@+2{{used as element type of array type 'int[4][5]'}} + // 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(+:ThreeDArray[1]) + while (1); + +#pragma acc parallel reduction(+:ThreeDArray[1:1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1:1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1:1]) + while (1); + +#pragma acc parallel reduction(+:ThreeDArray[1:1][1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1:1][1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1:1][1:1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1:1][1:1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1][1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1:1][1:1]) + while (1); +#pragma acc parallel reduction(+:ThreeDArray[1][1:1][1]) + while (1); } void inst() { |