llvm / llvm/llvm-project

[Flang] Compilation error with preprocessor output when -fopenmp is specified

Open
#184,748 2 comments 0 reactions 1 assignee Assigned to @akuhlens View on GitHub
flang:frontend flang:openmp
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

When compiling the following program, a compilation failure occurs if the program is first processed by the preprocessor and then compiled with Flang.

- sample.f
```Fortran
c$ 2 k=
end
```

- Result
```
$ flang -v
flang version 23.0.0git (https://github.com/llvm/llvm-project.git 3357e487cf0ee7bb9a565cb79ac7ea65f12583b0)
Target: aarch64-unknown-linux-gnu
...

$ flang -E -fopenmp sample.f -o sample.pp.f
$ cat sample.pp.f
#line "./sample.f" 1
!$ &k=
end

$ flang -S -fopenmp sample.pp.f
error: Could not parse sample.pp.f
./sample.f:1:8: error: expected '('
!$ &k=
^
./sample.f:1:7: in the context: statement function definition
!$ &k=
^
./sample.f:1:7: in the context: declaration construct
!$ &k=
^
```

The original program is from the Fujitsu Compiler Test Suite: [0213_0013.f](https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0213/0213_0013.f).
This issue might be a remaining bug from the fix for #136845.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.