<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63248>63248</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] [OpenMP] too much error messages when unclassifiable OpenMP directive is given
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
This issue is similar to https://github.com/llvm/llvm-project/issues/62299. Let's consider the following (invalid) Fortran program.
```console
$ cat omp.f90
do i = 0, 63
!$omp invalid
do j = 0, 63
end do
end do
end
```
Gfortran plainly reports that the given OpenMP directive is unclassifiable.
```console
$ gfortran -fopenmp omp.f90
omp.f90:2:9:
2 | !$omp invalid
| 1
Error: Unclassifiable OpenMP directive at (1)
```
Ifort plainly reports that the given OpenMP directive is invalid. (I checked this with godbolt.)
```console
/app/example.f90(2): error #7844: Invalid directive.
!$omp invalid
--^
compilation aborted for /app/example.f90 (code 1)
Compiler returned: 1
```
However, the flang-new emits too much error messages regarding the directive.
```console
$ flang-new -fopenmp omp.f90 2> error.txt
$ cat error.txt | grep "./omp.f90:2:9: error: expected"
./omp.f90:2:9: error: expected 'CRITICAL'
./omp.f90:2:9: error: expected 'ALLOCATE'
./omp.f90:2:9: error: expected 'ALLOCATORS'
./omp.f90:2:9: error: expected 'ALLOCATE'
./omp.f90:2:9: error: expected 'ATOMIC'
./omp.f90:2:9: error: expected 'CANCELLATION POINT'
./omp.f90:2:9: error: expected 'CANCEL'
./omp.f90:2:9: error: expected 'FLUSH'
./omp.f90:2:9: error: expected 'TASKYIELD'
./omp.f90:2:9: error: expected 'TASKWAIT'
./omp.f90:2:9: error: expected 'TARGET UPDATE'
./omp.f90:2:9: error: expected 'TARGET EXIT DATA'
./omp.f90:2:9: error: expected 'TARGET ENTER DATA'
./omp.f90:2:9: error: expected 'ORDERED'
./omp.f90:2:9: error: expected 'BARRIER'
./omp.f90:2:9: error: expected 'WORKSHARE'
./omp.f90:2:9: error: expected 'TEAMS'
./omp.f90:2:9: error: expected 'TASKGROUP'
./omp.f90:2:9: error: expected 'TASK'
./omp.f90:2:9: error: expected 'TARGET'
./omp.f90:2:9: error: expected 'TARGET TEAMS'
./omp.f90:2:9: error: expected 'TARGET PARALLEL'
./omp.f90:2:9: error: expected 'TARGET DATA'
./omp.f90:2:9: error: expected 'SINGLE'
./omp.f90:2:9: error: expected 'PARALLEL'
./omp.f90:2:9: error: expected 'PARALLEL WORKSHARE'
./omp.f90:2:9: error: expected 'ORDERED'
./omp.f90:2:9: error: expected 'MASTER'
./omp.f90:2:9: error: expected 'UNROLL'
./omp.f90:2:9: error: expected 'TILE'
./omp.f90:2:9: error: expected 'TEAMS DISTRIBUTE'
./omp.f90:2:9: error: expected 'TEAMS DISTRIBUTE SIMD'
./omp.f90:2:9: error: expected 'TEAMS DISTRIBUTE PARALLEL DO'
./omp.f90:2:9: error: expected 'TEAMS DISTRIBUTE PARALLEL DO SIMD'
./omp.f90:2:9: error: expected 'TASKLOOP'
./omp.f90:2:9: error: expected 'TASKLOOP SIMD'
./omp.f90:2:9: error: expected 'TARGET TEAMS DISTRIBUTE'
./omp.f90:2:9: error: expected 'TARGET TEAMS DISTRIBUTE SIMD'
./omp.f90:2:9: error: expected 'TARGET TEAMS DISTRIBUTE PARALLEL DO'
./omp.f90:2:9: error: expected 'TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD'
./omp.f90:2:9: error: expected 'TARGET SIMD'
./omp.f90:2:9: error: expected 'TARGET PARALLEL DO'
./omp.f90:2:9: error: expected 'TARGET PARALLEL DO SIMD'
./omp.f90:2:9: error: expected 'SIMD'
./omp.f90:2:9: error: expected 'PARALLEL DO'
./omp.f90:2:9: error: expected 'PARALLEL DO SIMD'
./omp.f90:2:9: error: expected 'DO'
./omp.f90:2:9: error: expected 'DO SIMD'
./omp.f90:2:9: error: expected 'DISTRIBUTE'
./omp.f90:2:9: error: expected 'DISTRIBUTE SIMD'
./omp.f90:2:9: error: expected 'DISTRIBUTE PARALLEL DO'
./omp.f90:2:9: error: expected 'DISTRIBUTE PARALLEL DO SIMD'
./omp.f90:2:9: error: expected 'PARALLEL SECTIONS'
./omp.f90:2:9: error: expected 'SECTIONS'
./omp.f90:2:9: error: expected 'END'
```
It looks like the flang-new is pointing out all the possibe keywords. This is not a bug, but I think it's verbose as an error message.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEWF9vo7oT_TTOy6goGNokD3mgCemipaEiVPv7PTowId4ajGwn2f32V4Z0q6bdu_dCpFtVLXY4Z-bMHysepjUva8Q5ub0nt8sRO5i9VPOXG6aUPOnRVhY_59mea-BaHxC4Bs0rLpgCI2FvTKOJFxC6InRVcrM_bJ1cVoSuhDi-_rtplPyOuSF01ZJoQld3lM5mDsRoCJ1oyGWteYEKzB5hJ4WQJ16XQOiU10cmeEHoDFZSGcVqaJQsFascMl6ScUDuxt2v5ZACz7vUh5wZkFXj7GbjbrOQwIF4SxgTuoA7r9sFINQl1JdVA6_Wzh8UEr5_BsC6gEJ2q4vnC6e65cPu1XXBeC1-gsJGKqPB7JlpNZf8iDUkDdaPT1BwhbnhxzbchzoXNks7zrYC_yi6fDV1s5MN1lXzPgSvCy-gxAtmNncd9KwMgAKZLOBvgmJ_7CtutxEqJRXxAnh-5-hHLczYfLqEzj6NUWQd7xOgs3uOZY8g32P-ggUYW7MnbvZQymIrhXE-Gr4I3oo1DaEr_MGqRmAbJjqlFuYFgFYmEOpNpr5vN6LO7Jsvzh_K6eaG3IbdYy6rhgtmuKyBbaUyWMCupf_og5WVywLhLXKLFo4KFJqDqrGw_rifRrX7-0We8IjKFnHbYILV5U2NJ8CK2yBLCdUh359FVqg1K1GDwpKpwjaiRV0K_X0NvvFfFiFQ4oWdGcf8MO979dd2W16lwgYIpQ6hq49V273cPvxoMDdYEEo7un8KAEInizTKokUQEzr59-AgjpNFkIVDwEm6-Q9sZ8ljtOg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