diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2018-09-28 19:33:14 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-09-28 19:33:14 +0000 |
| commit | bc52967835fd22933d01bc6ea55ff79f37e1f211 (patch) | |
| tree | 6e0a52bf0cf263565c65923c5810a4a7e37cd2e2 /clang/test/OpenMP/for_reduction_messages.cpp | |
| parent | 98aa64342046d70105f031a13daac816f9e55943 (diff) | |
| download | bcm5719-llvm-bc52967835fd22933d01bc6ea55ff79f37e1f211.tar.gz bcm5719-llvm-bc52967835fd22933d01bc6ea55ff79f37e1f211.zip | |
[OPENMP]Fix PR39084: Check datasharing attributes of reduction variables only.
According to OpenMP, the reduction item must be shared in parent region.
But the item can be an array section or array subscript. In this case,
we should not check for the datasharing of the base declaration.
llvm-svn: 343356
Diffstat (limited to 'clang/test/OpenMP/for_reduction_messages.cpp')
| -rw-r--r-- | clang/test/OpenMP/for_reduction_messages.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/test/OpenMP/for_reduction_messages.cpp b/clang/test/OpenMP/for_reduction_messages.cpp index a4f15aa6193..520097de668 100644 --- a/clang/test/OpenMP/for_reduction_messages.cpp +++ b/clang/test/OpenMP/for_reduction_messages.cpp @@ -214,12 +214,12 @@ T tmain(T argc) { #pragma omp for reduction(+ : fl) // expected-error 2 {{reduction variable must be shared}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp parallel private(qa) // expected-note 2 {{defined as private}} -#pragma omp for reduction(+ : qa[1], get()[0]) // expected-error 2 {{reduction variable must be shared}} expected-error {{expected variable name as a base of the array subscript}} +#pragma omp parallel private(qa) +#pragma omp for reduction(+ : qa[1], get()[0]) // expected-error {{expected variable name as a base of the array subscript}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel shared(qa) -#pragma omp for reduction(+ : qa[1], qa[0]) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}} +#pragma omp for reduction(+ : qa[1], qa[0]) for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel reduction(* : fl) // expected-note 2 {{defined as reduction}} @@ -379,12 +379,12 @@ int main(int argc, char **argv) { #pragma omp for reduction(+ : fl) // expected-error {{reduction variable must be shared}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp parallel private(argv) // expected-note {{defined as private}} -#pragma omp for reduction(+ : argv[1], get()[0]) // expected-error {{reduction variable must be shared}} expected-error {{expected variable name as a base of the array subscript}} +#pragma omp parallel private(argv) +#pragma omp for reduction(+ : argv[1], get()[0]) // expected-error {{expected variable name as a base of the array subscript}} expected-error {{invalid operands to binary expression ('char *' and 'char *')}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel shared(qa) -#pragma omp for reduction(+ : qa[1], qa[0]) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}} +#pragma omp for reduction(+ : qa[1], qa[0]) for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel reduction(* : fl) // expected-note {{defined as reduction}} |

