<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64128>64128</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Error in Fortran parsing/preprocessor when compiling with OpenMP enabled
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:frontend
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          kiranchandramohan
      </td>
    </tr>
</table>

<pre>
    A parse/preprocessor error was observed while compiling Fortran code containing an include directive in a subroutine.

**Source**
`ab.f90`
```
subroutine simple()
 implicit none
  !$ include 'inc.f90'
end subroutine simple
```
`inc.f90`
```
print *, "Hello"
```

**Error**
```
flang-new  ab.f90 -fopenmp
error: Could not parse ab.f90
./ab.f90:3:14: error: expected '('
    !$ include 'inc.f90'
               ^
./ab.f90:3:6: in the context: statement function definition
    !$ include 'inc.f90'
 ^
./ab.f90:3:6: in the context: declaration construct
    !$ include 'inc.f90'
       ^
./ab.f90:2:3: in the context: specification part
 implicit none
    ^
./ab.f90:1:1: in the context: SUBROUTINE subprogram
  subroutine simple()
  ^
```

Note: This was observed while compiling BigDFT (https://bigdft.org/?i=1, https://gitlab.com/l_sim/bigdft-suite/-/blame/devel/futile/dicts/callbacks.f90#L71)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE2P2zYQ_TXUhbAhUV_WQQdvvEILtEnRbM4FRY6kaShSICk7_fcFJdm7SbyLbg3ZJkcz8zhvho87h70GqEn-QPJTxGc_GFt_Rcu1GLiWlo9m4DpqjfynPtKJWweENZOFyRoBzhlLwVpj6YU7aloH9gySXgZUQIUZJ1Soe9oY6y3XVBgZzNpz1MHONUUt1CyBSrQgPJ6Boqacurm1ZvaoYU_iE4mP2y8Lz2czWwHrerMXMW_3XRWTIr5ZtmfZPuejDsdJAWEHwqr1JQ0WFOipNho2GyUsISy7HZCwErVYMFi5-oCW9OfE9-BJEV-DXzngZFF7utT0gRLGfgGlDGHsfroXZDwG-n_g4qVvp7judxoulK4U0V1nJtDjtBWxxKdH-sHMSlJt_NrmzXt12hPWbPv0mJL0mGQh5BYL3yYQHmRgaWG2vLL4X3ik339I_vgKahGwUFM_rGME33ywOM89jKA97WYtPBpNJXSoMSzfdZB3Q0sQilu-YAqjnbez8P-j9vvAbAO_V_MEAjsUK_TErX9rll8DSLbvHYDPXx7-_PTl6dePj2HGJ2t6y8drvrev0zPY3bn9aDwEhKcB3du68YD9qXmihB0G7ydH0iNhDWFNi73s_N7YPuzTBkl6SsLF-d6tR694uxdmJKxRfzkcb7E7N6MPUrYLJsXHsJZwBkVY080e1WJA4R1hjeBKtVx8dWvr0t_K5FZtJOtUVmnFI6iToorT8lCVLBrqrpB5mcuDFBUvy7IqD2XcsbbMuWzjshUR1ixmaVyyIkkzlrN9lrVVDpJBmnOeF4JkMYwc1V6p8xiqjdC5GeoiS9ghUrwF5RbpZmy55SQ9djZ0UMugHPkpsnUI3bVz70gWK3TePSfz6NUi_c0SnJ_ooiVhFq6CHZQAdf-j5F8G0C_adEE_0E8T6N__oKB5q0BGs1X1T90Y5ls31Pn6t5us-RuEJ6xZyguELxX-GwAA__9XkvUa">