Skip to content

[Flang][OpenMP] Compilation error when continuation lines of OpenMP (free source form conditional compilation sentinel) and Fortran free source form are mixed #89559

@ohno-fj

Description

@ohno-fj
Version of flang-new : 19.0.0(4f19f15a601a5761b12c9c66d99d97dbc89ef90d)/AArch64

When the following free form statement continuation are mixed, a compilation error occurs.

  • Continuation line of OpenMP (free source form conditional compilation sentinel)
  • Continuation line of Fortran free source form

When there is no mixing, a compilation terminates normally.

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

ompc_066_.f90:

program main
!$ i = 0
 i = 1&
   !$ +10 &
!$+100&
!$&+ 1000&
 &+ 10000&
!$& +100000&
 & +1000000

if(i .eq. 1111111) then
  print *, 'OK'
else
  print *, 'NG'
endif
end program main
$ flang-new -fopenmp ompc_066_.f90
error: Could not scan ompc_066_.f90
./ompc_066_.f90:3:7: error: bad character ('&') in Fortran token
   i = 1&
        ^
./ompc_066_.f90:6:10: error: bad character ('&') in Fortran token
  !$&+ 1000&
           ^
./ompc_066_.f90:7:2: error: bad character ('&') in Fortran token
   &+ 10000&
   ^
./ompc_066_.f90:7:10: error: bad character ('&') in Fortran token
   &+ 10000&
           ^
./ompc_066_.f90:8:3: error: bad character ('&') in Fortran token
  !$& +100000&
    ^
./ompc_066_.f90:8:12: error: bad character ('&') in Fortran token
  !$& +100000&
             ^
$
$ gfortran -fopenmp ompc_066_.f90; ./a.out
 OK
$
$ ifort -qopenmp -diag-disable=10448 ompc_066_.f90; ./a.out
 OK
$

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions