Issue 148299
Summary Flang OpenMP: metadirective "not yet implemented" warning doesn't get emitted if optional conditions are included.
Labels flang
Assignees
Reporter scamp-nvidia
    Testing with some SPEC Accel V2 fortran suites has revealed an OpenMP issue where if a metadirective includes an optional statement then instead of emitting a "not yet implemented" warning for metadirective clauses - the compiler emits a warning about variables appearing in multiple data sharing clauses. This sort of behavior could lead to users wasting their time trying to get something to work that, currently, will not. 

test.F90:
```
#define ENTER1   .false.
#define ENTER2    .false.
MODULE metatest
CONTAINS
SUBROUTINE metacrash(y_min,y_max,x_max,x_min,density)
 IMPLICIT NONE
  INTEGER :: y_max,y_min,x_min,x_max
  INTEGER :: j,k
 REAL(KIND=8) :: v, density(:,:)
!$omp metadirective &
!$omp when(user={condition(ENTER1)}: &
!$omp      target teams distribute parallel do collapse(2) &
!$omp      private(v)) &
!$omp  default( &
!$omp      target teams loop collapse(2) &
!$omp      private(v))
 DO k=y_min,y_max
    DO j=x_min,x_max
      v=1.0_8/density(j,k)
 ENDDO
  ENDDO
END SUBROUTINE metacrash
END MODULE metatest
```
Compiling this with a recent upstream compiler:

```
scamp@genx4:/local/home/scamp$ flang --version
flang version 21.0.0git (https://github.com/llvm/llvm-project ed8548796f8538df420eccc6fa57d06d238996ed)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /proj/nv/llvm/Linux_x86_64/llvm-5531/bin
Build config: +assertions
scamp@genx4:/local/home/scamp$ flang test.F90 -fopenmp -c -fopenmp-version=50
warning: OpenMP support for version 50 in flang is still incomplete
error: Semantic errors in test.F90
./test.F90:16:20: error: 'v' appears in more than one data-sharing clause on the same OpenMP directive
 !$omp      private(v))
                     ^
```
Whereas if I comment out the condition and use just the default - I get the expected message: 

```
error: loc("/local/home/scamp/test.F90":5:1): /proj/build/llvm/Linux_x86_64/flang/lib/Lower/OpenMP/OpenMP.cpp:3495: not yet implemented: METADIRECTIVE
LLVM ERROR: aborting
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to