<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/193180>193180</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Spurious error for fixed format OpenMP directive that is continued or contains comment
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ejose02
</td>
</tr>
</table>
<pre>
Flang fails to parse valid fixed-format Fortran code containing OpenMP directives that use continuations across multiple lines with different sentinels and include comment lines.
Expected Behavior: Fixed-format OpenMP directives should support continuation across multiple lines using continuation markers in column 6, comment lines within directives, and mixed OpenMP sentinels
Actual Behavior: Flang produces parsing errors for valid fixed-format OpenMP code. For the testcase given, the error message is:
```
error: expected 'END'
!$omp section seq00008
^
```
Reproducer:
`test.f`
```fortran
program test
call sub1
call sub2
contains
subroutine sub1 seq00001
!23456789012345678901234567890123456789012345678901234567890123456789012seq00002
*$omp paral seq00003
c$ompxlel s seq00004
c$ompyections n seq00005
!$ompz u m _ t h r e a d s ( 2 ) seq00006
!$omp section seq00008
*$ print *,'in section' seq00009
!$omp end parallel sections seq00010
end subroutine seq00011
subroutine sub2
!$omp sections
!$omp sect
!$omp ! should be ignored, and make the continuation correct
!$omp+ion
print *,'ok'
!$omp end sections
end subroutine
end program
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVclu8zYQfhr6MohBUbYlH3Rw_sS3LmgfoKCkkcQ_FKlySDfp0xekLDnOcqphwMas3zcbJZHqDWLF9o9s_7SRwQ_WVfjTEnKxqW37Vp21ND10UmkCb2GSjhAuUqsWOvWK7UNn3Sg9nK3zThpobIvQWOOlMsr08NuE5pffoVUOG68uSOAH6SHQbKVMkF5ZQyAbZ4lgDNqrSSNoZZDgH-UHaFXXoUPjgTC6oCaQpgVlGh1SunGM2uSyZfzE-On5dcLGYwuPOMiLso7lJzi_R_wZGQ026BYoTJN1_g7f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