<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/100345>100345</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Preprocessor too aggressively removes continuation lines
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mjklemm
</td>
</tr>
</table>
<pre>
With this reproducer:
```Fortran
program omp_blank_continuation
use omp_lib
implicit none
integer :: tid
!$omp parallel &
#ifdef XYZ
!$omp default(none) &
#endif
!$omp private(tid)
tid = omp_get_thread_num()
print '(A," ",I0)', 'Hello from', tid
!$omp end parallel
end program omp_blank_continuation
```
The preprocessors generates invalid OpenMP directives:
```
> flang-new -fopenmp -cpp -c omp_blank_continuation.f90 [amd-trunk-dev:dev]
error: Could not parse omp_blank_continuation.f90
./omp_blank_continuation.f90:7:12: error: expected OpenMP construct
!$omp parallel &
^
./omp_blank_continuation.f90:7:5: in the context: specification construct
!$omp parallel &
^
./omp_blank_continuation.f90:7:5: in the context: declaration construct
!$omp parallel &
^
./omp_blank_continuation.f90:2:5: in the context: specification part
use omp_lib
^
./omp_blank_continuation.f90:1:1: in the context: main program
program omp_blank_continuation
^
./omp_blank_continuation.f90:14:5: error: expected 'END'
!$omp end parallel
^
./omp_blank_continuation.f90:14:5: in the context: END PROGRAM statement
!$omp end parallel
^
./omp_blank_continuation.f90:1:1: in the context: main program
program omp_blank_continuation
^
./omp_blank_continuation.f90:14:5: error: expected 'END PROGRAM'
!$omp end parallel
^
./omp_blank_continuation.f90:14:5: in the context: END PROGRAM statement
!$omp end parallel
^
./omp_blank_continuation.f90:1:1: in the context: main program
program omp_blank_continuation
^
```
This is due to seemingly too agressive removal of continuation lines:
```Fortran
#line "./omp_blank_continuation.f90" 1
program omp_blank_continuation
use omp_lib
implicit none
integer :: tid
!$omp parallel !$omp private(tid)
tid = omp_get_thread_num()
print '(A," ",I0)', 'Hello from', tid
!$omp end parallel
end program omp_blank_continuation
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVk2P2zYQ_TXUZWBDGkn-OOjgrNdtD0kWQYF-XBa0OJKYpUiBpNzsvy-olb1O1nbtomkvFWwaIId8M2-eqcedk7UmKlj-juXriPe-MbZoPz8pattoa8Rz8Yv0DfhGOrDUWSP6kixLVyxes3g_zuKXz8ZYb7l-me2sqS1vwbTd41Zx_fRYGu2l7rmXZoyB3tEQoOR2nAEA2XZKltKDNpqOgYZF7akmCyGHdAVeim8jGCYMM9N20HHLlSIFDGdjFKayElTBr7_9fmqHoIr3yjNcDNi4_GoraSGrk0BW7rgnhouQDy5fY8LjpQCWrodCa_KPvrHExaPuW4aLN9GdldoDwznDxYrhHUMEhsjw7qc4BIeFu7D-IylloLKmHecOXHydHGlxYOJlfZi5oj2Hxh5T_HND0A1aKMk5Yx3UpMlyTw6k3nElBXzsSL9_ACEtlV7uyL0q5psj03uoFNf1RNMfMKlMR7rtYFJ2YTiT3LRaxsDyd7wVE297_TQRtGPpKoz5eizRWhN0CnemVwK08YGDUW2nj3zZOGW4uRCTruYsXSUYjj5g0JeOSk-Hukujnbd96Y87e0mWwPL7G-DzACo1-IYClqcvPsy4jkpZyXII_6-SEFQqbr9_CngtDx23_tJtAzeAJuP3BGjLpd7_qfaHX3UF3oCe7Wt-qzyG8_sP63ARnKT67R1wc-nZecLvP6zh4dPHHz6t3oPz3FNL-kzPTyTyvei_iv1_lP49Cbe04f8OHNDPvG6kA-lA9ATegCNqpa7VM3hjgNeWnJM7Akut2XEFpoJjDFBSH799LvgVhmkIDu_av6ABEZJjbq8rMzxnLqDzhudvup3LvuTceKNf-ReMCtzsVCJRpGKZLnlERTLHZJEsMkyjpkjy7VzwajmvEoEzMZvhfIFbMasEUbZNKZIFxpjFc8ySOE-zdLrkJVGSxstsFuM8S1gWU8ulmiq1a6fG1pF0rqciieM0yyPFt6TcYKURB08TyMjXkS3Chsm2rx3LYiWdd69HeOnV4L83w458DQ9H3moU-V7l6vlF5-ROiDzqrSoa77tB7rhhuKmlb_rttAzEbwLk-DPprPlMpWe4GUpwDDdjFbsC_wwAAP__j1mrCA">