Skip to content

[Flang] !$ output by preprocessor results in scan error with -fopenmp #136845

Closed
@kawashima-fj

Description

@kawashima-fj

#133959 changed behavior of the preprocessor.

test1.f:

c$   !1
      end

One-pass compilation succeeds.

$ flang -S -fopenmp test1.f
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
$

Two-pass compilation via a proprocessed file fails.

$ flang -E -fopenmp test1.f -o test1.pp.f
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
$ cat test1.pp.f
#line "./test1.f" 1
!$    &1
      end
$ flang -S -fopenmp test1.pp.f
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: Could not scan test1.pp.f
./test1.f:1:7: error: bad character ('&') in Fortran token
  !$    &1
        ^
$

The following is another example.

test2.f:

C$   
              end
$ flang -S -fopenmp test2.f
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
$
$ flang -E -fopenmp test2.f -o test2.pp.f
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
$ cat test2.pp.f
#line "./test2.f" 1
!$    & end
              end
$ flang -S -fopenmp test2.pp.f
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: Could not scan test2.pp.f
./test2.f:1:7: error: bad character ('&') in Fortran token
  !$    & end
        ^

Before #133959, two-pass compilation succeeded.

@klausler Is this an intended behavior?

This issue was detected as a regression by the following tests in the Fujitsu Compiler Test Suite.

  • Fortran/0213/0213_0000.f
  • Fortran/0213/0213_0001.f
  • Fortran/0213/0213_0008.f
  • Fortran/0213/0213_0009.f
  • Fortran/0213/0213_0011.f
  • Fortran/0213/0213_0012.f
  • Fortran/0213/0213_0013.f
  • Fortran/0213/0213_0017.f
  • Fortran/0213/0213_0020.f
  • Fortran/0213/0213_0026.f
  • Fortran/0213/0213_0028.f
  • Fortran/0213/0213_0032.f

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions