Issue |
130312
|
Summary |
Flang OpenMP default(none) clause is ignored when there is a single construct inside a parallel construct
|
Labels |
|
Assignees |
|
Reporter |
scamp-nvidia
|
The compiler should give a compilation error with the attached test program because we have specified "default(none)" but have not specified the data-sharing for variable "x". This incorrect behavior only occurs when there is a single construct inside the parallel construct.
The relevant text from the OpenMP 6.0 specification is as follows
> 223:3 7.5.1 default Clause
> 224:11 * If data-sharing-attribute is none, each variable that is referenced in the construct and does
> 224:12 not have a predetermined data-sharing attribute must have an explicitly determined
> 224:13 data-sharing attribute.
Instead, we get an incorrect successful compilation with flang - whereas we get correct failures with nvfortran and gfortran.
Our sample code:
test.F90
```
Program main
implicit none
integer :: x
x = 1
!$omp parallel default(none)
!$omp single
print *, "x=", x
!$omp end single
!$omp end parallel
End Program main
```
Compiling with Flang versus other compilers:
```
scamp@dev-sky5:~$ flang --version
flang version 21.0.0git (https://github.com/llvm/llvm-project db5e4016c0332e7e5c0950414bb0b252975663ed)
Target: x86_64-unknown-linux-gnu
....
scamp@dev-sky5:~$ flang test.F90 -o test -fopenmp
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
scamp@dev-sky5:~$ ./test
x= 1
scamp@dev-sky5:~$ gfortran test.F90 -o test -fopenmp
test.F90:16:18:
16 | print *, "x=", x
| ^
Error: ‘x’ not specified in enclosing ‘parallel’
test.F90:14:30:
14 | !$omp parallel default(none)
| ^
note: enclosing ‘parallel’
scamp@dev-sky5:~$ nvfortran test.F90 -o test -mp
NVFORTRAN-S-0155-x must appear in a SHARED or PRIVATE clause (test.F90: 16)
0 inform, 0 warnings, 1 severes, 0 fatal for main
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs