[flang-commits] [flang] [flang] More graceful parse failures at EOF (PR #159834)

Shunsuke Watanabe via flang-commits flang-commits at lists.llvm.org
Thu Oct 30 00:26:38 PDT 2025


s-watanabe314 wrote:

@klausler 
I apologize for the very late comment, but it seems that after this PR, the following test programs now result in compilation errors:
https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0213/0213_0025.f
https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0213/0213_0029.f

The programs are as follows. The compilation options are `-O0 -fopenmp`.

- 0213_0025.f
```
      print *,'pass'
      end
c$      !
c$      !
c$      !
c$      !
```
- 0213_0029.f
```
      print *,'pass'
      end
c$      !
c$      !
c$      !
c$      !
C$      !
C$      !
C$      !
C$      !
!$      !
!$      !
!$      !
*$      !
*$      !
*$      !
*$      !
*$      !
```

```
$ flang -O0 -fopenmp 0213_0025.f -c
error: Could not parse 0213_0025.f
./0213_0025.f:4:7: error: expected declaration construct
  c$      !
        ^
./0213_0025.f:3:7: in the context: specification part
  c$      !
        ^
./0213_0025.f:6:10: error: end of file
  c$      !
           ^
in the context: END PROGRAM statement
./0213_0025.f:3:7: in the context: main program
  c$      !
        ^
error: expected declaration construct
./0213_0025.f:3:7: in the context: specification part
  c$      !
        ^
```

Is this behavior expected?

https://github.com/llvm/llvm-project/pull/159834


More information about the flang-commits mailing list