Issue 169536
Summary [flang][OpenMP][regression] Flang compiles bad openmp semantics.
Labels flang
Assignees
Reporter scamp-nvidia
    In our testing system, we identifed another issue that appears to be related to #168884 change of OpenMP behavior - tagging @kparzysz here again. 

In the following test, we expect the compilation to fail with an error message complaining about the OMP ENDDO. 

```
      SUBROUTINE WORK_SAN(IVAR, JVAR)
      INTEGER IVAR,JVAR
      END SUBROUTINE WORK_SAN

 SUBROUTINE DO_OMP_ISSUE
        INTEGER IVAR, JVAR

        DO 100 IVAR = 1,10
!$OMP     DO
          DO 100 JVAR = 1,10
            CALL WORK_SAN(IVAR,JVAR)
100     CONTINUE
!$OMP   ENDDO
      END SUBROUTINE DO_OMP_ISSUE
```

However, after that recent change, this no longer fails - it actually compiles. It fails as expected with nvfortran and gfortran. 

```
[scamp]$ nvfortran test.F90 -c -fopenmp
NVFORTRAN-S-0155-ENDDO must immediately follow a DO loop  (test.F90: 13)
  0 inform,   0 warnings,   1 severes, 0 fatal for do_omp_issue
[scamp]$ gfortran test.F90 -c -fopenmp
test.F90:10:28:

   10 |           DO 100 JVAR = 1,10
      | 1
Warning: Fortran 2018 deleted feature: Shared DO termination label 100 at (1)
test.F90:13:13:

   13 | !$OMP   ENDDO
 |             1
Error: Unexpected !$OMP END DO statement at (1)
[scamp]$ flang test.F90 -c -fopenmp
[scamp]$
```

Prior to this change, we would get a warning in line with: 

```
./test.F90:13:9: error: The ENDDO directive must follow the DO loop associated with the loop construct
  !$OMP ENDDO
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to