summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/target_parallel_for_ast_print.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-05-09 10:47:45 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-05-09 10:47:45 +0000
commitb32a02b5bc6a335f2ac9bbfe1bebd8ab0fa29184 (patch)
tree2383f573aa10978af99a23f26e410fa4ca3c3d32 /clang/test/OpenMP/target_parallel_for_ast_print.cpp
parenteba9a6e08fcbd16c8f52b9977475e349073bcf8c (diff)
downloadbcm5719-llvm-b32a02b5bc6a335f2ac9bbfe1bebd8ab0fa29184.tar.gz
bcm5719-llvm-b32a02b5bc6a335f2ac9bbfe1bebd8ab0fa29184.zip
Revert "[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with default(none)."
This implementation isn't sound as per the standard. It erroneously diagnoses e.g. the following case: ``` $ cat test.cpp void f(int n) { #pragma omp parallel default(none) if(n) ; } ``` ``` $ ./bin/clang -fopenmp test.cpp test.cpp:2:40: error: variable 'n' must have explicitly specified data sharing attributes #pragma omp parallel default(none) if(n) ^ test.cpp:2:31: note: explicit data sharing attribute requested here #pragma omp parallel default(none) if(n) ^ 1 error generated. ``` As per OpenMP Application Programming Interface Version 5.0 November 2018: * 2.19.4.1default Clause The default clause explicitly determines the data-sharing attributes of variables that are referenced *in a parallel, teams, or task generating construct and would otherwise be implicitly determined (see Section 2.19.1.1 on page 270). * 2.6.1 Determining the Number of Threads for a parallel Region Using a variable in an if or num_threads clause expression of a parallel construct causes an implicit reference to the variable in all enclosing constructs. The if clause expression and the num_threads clause expression are evaluated in the context outside of the parallel construct, This reverts commit r360073. llvm-svn: 360326
Diffstat (limited to 'clang/test/OpenMP/target_parallel_for_ast_print.cpp')
-rw-r--r--clang/test/OpenMP/target_parallel_for_ast_print.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/OpenMP/target_parallel_for_ast_print.cpp b/clang/test/OpenMP/target_parallel_for_ast_print.cpp
index 80c20baca0b..5e22ef3dd8e 100644
--- a/clang/test/OpenMP/target_parallel_for_ast_print.cpp
+++ b/clang/test/OpenMP/target_parallel_for_ast_print.cpp
@@ -176,8 +176,8 @@ int main(int argc, char **argv) {
// CHECK: static int a;
static float g;
#pragma omp threadprivate(g)
-#pragma omp target parallel for schedule(guided, argc) default(none) linear(a) shared(argc)
- // CHECK: #pragma omp target parallel for schedule(guided, argc) default(none) linear(a) shared(argc)
+#pragma omp target parallel for schedule(guided, argc) default(none) linear(a)
+ // CHECK: #pragma omp target parallel for schedule(guided, argc) default(none) linear(a)
for (int i = 0; i < 2; ++i)
a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
OpenPOWER on IntegriCloud