Issue 136845
Summary [Flang] `!$` output by preprocessor results in scan error with -fopenmp
Labels flang:parser
Assignees klausler
Reporter kawashima-fj
    #133959 changed behavior of the preprocessor.

`test1.f`:

```fortran
c$   !1
 end
```

One-pass compilation succeeds.

```console
$ 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.

```console
$ 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`:

```fortran
C$   
 end
```

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

```console
$ 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](https://github.com/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

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to