Skip to content

[Flang,OpenMP] preprocessor inside of OpenMP statements break parse #100730

@jeffhammond

Description

@jeffhammond

This is extracted from GAMESS. If one removes the preprocessor statements, it compiles fine.

flang-new -fdefault-integer-8 -fopenmp -c ibm.F90
error: Could not parse ibm.F90
./ibm.F90:8:8: error: expected OpenMP construct
  !$omp parallel do default(none) schedule(dynamic,1) &
         ^
./ibm.F90:8:1: in the context: specification construct
  !$omp parallel do default(none) schedule(dynamic,1) &
  ^
./ibm.F90:8:1: in the context: declaration construct
  !$omp parallel do default(none) schedule(dynamic,1) &
  ^
./ibm.F90:3:4: in the context: specification part
     integer,INTENT(IN)    :: this
     ^
./ibm.F90:1:4: in the context: SUBROUTINE subprogram
     SUBROUTINE SymUnPack1234(this,rdim,cdim)
     ^
   SUBROUTINE SymUnPack1234(this,rdim,cdim)

   integer,INTENT(IN)    :: this
   INTEGER,INTENT(IN)        :: rdim,cdim
   REAL             :: x
   INTEGER                   :: i,j,ijsym,ij,ji,a,b,ab,ba

!$omp parallel do default(none) schedule(dynamic,1) &
#ifndef __ibmxl__
!$omp shared(this)                                                        &
#endif
!$omp shared(no,nu,noo)                                              &
!$omp private(ijsym,i,j,ij,ji,a,b,ab,ba,x)

     do ijsym=1,noo
        x = 0.5
        i = FLOOR(x)
        j = ijsym - i*(i-1)/2
        if(j .EQ. 0)then
           i = i-1
           j = i
        end if
        ij = (i-1)*no+j
        ji = (j-1)*no+i
   end do

!$omp end parallel do

   END SUBROUTINE SymUnPack1234

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions