]> granicus.if.org Git - clang/commit
Revert "[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with default(none)."
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 9 May 2019 10:47:45 +0000 (10:47 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 9 May 2019 10:47:45 +0000 (10:47 +0000)
commitae700142cf513536f8b0681d6f93fa6e21217481
tree76bf012405d91df1cc063b942eb0af8c249908dd
parentcd7db9f83fe7c6aeaba4cd481423c39f1bd5647c
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360326 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaOpenMP.cpp
test/OpenMP/distribute_parallel_for_ast_print.cpp
test/OpenMP/distribute_parallel_for_simd_ast_print.cpp
test/OpenMP/parallel_for_ast_print.cpp
test/OpenMP/parallel_for_schedule_messages.cpp
test/OpenMP/target_parallel_for_ast_print.cpp
test/OpenMP/target_parallel_for_simd_ast_print.cpp
test/OpenMP/target_teams_distribute_parallel_for_if_messages.cpp