<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82212>82212</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error of directive (!DIR$ ATTRIBUTES FORCEINLINE)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 19.0.0(730f498c961f29691a605028f9b1cd6d9e232460)
```
The following is a program with directive (`!DIR $ATTRIBUTES FORCEINLINE`):
1. The following is an correct description:
```
!DIR$ ATTRIBUTES FORCEINLINE :: sub
```
flang parses the directive and results in `Could not parse` error.
2. The following is an incorrect description:
```
!DIR$ ATTRIBUTES FORCEINLINE
```
flang parses the wrong directive and ignores it.
Because of these behaviors, flang seems to work for this directive.
Therefore, it seems to be a problem that `1.` becomes a compilation error.
ifort can compile successfully.
Gfortran seems to consider this directive as a comment line.
The following are the test program, Flang-new, Gfortran and ifort compilation result.
This is the program for `1.`.
comm_.F:
```fortran
!DIR$ ATTRIBUTES FORCEINLINE :: sub
subroutine sub(a,b)
real(8) :: a,b
a =0.
b =1.
end subroutine sub
```
```
$ flang-new comm_.F -c
error: Could not parse comm_.F
./comm_.F:1:30: error: expected end of statement
!DIR$ ATTRIBUTES FORCEINLINE :: sub
^
./comm_.F:1:1: in the context: specification construct
!DIR$ ATTRIBUTES FORCEINLINE :: sub
^
./comm_.F:1:1: in the context: declaration construct
!DIR$ ATTRIBUTES FORCEINLINE :: sub
^
./comm_.F:1:1: in the context: specification part
!DIR$ ATTRIBUTES FORCEINLINE :: sub
^
./comm_.F:1:1: in the context: main program
!DIR$ ATTRIBUTES FORCEINLINE :: sub
^
./comm_.F:2:26: error: expected '='
subroutine sub(a,b)
^
./comm_.F:2:7: in the context: statement function definition
subroutine sub(a,b)
^
./comm_.F:2:7: in the context: declaration construct
subroutine sub(a,b)
^
./comm_.F:1:1: in the context: specification part
!DIR$ ATTRIBUTES FORCEINLINE :: sub
^
./comm_.F:1:1: in the context: main program
!DIR$ ATTRIBUTES FORCEINLINE :: sub
^
./comm_.F:6:11: error: expected end of statement
end subroutine sub
^
./comm_.F:6:7: in the context: END PROGRAM statement
end subroutine sub
^
./comm_.F:1:1: in the context: main program
!DIR$ ATTRIBUTES FORCEINLINE :: sub
^
$
```
```
$ gfortran comm_.F -c
$
```
```
$ ifort -diag-disable=10448 comm_.F -c
$
```
This is the program for `2.`.
comm_2.F:
```fortran
!DIR$ ATTRIBUTES FORCEINLINE
subroutine sub(a,b)
real(8) :: a,b
a =0.
b =1.
end subroutine sub
```
```
$ flang-new comm_2.F -c
./comm_2.F:1:2: warning: Compiler directive was ignored
!DIR$ ATTRIBUTES FORCEINLINE
^^^^^^^^^^^^^^^^^^^^^^^^^^^
$
```
```
$ gfortran comm_2.F -c
$
```
```
$ ifort -diag-disable=10448 comm_2.F -c
comm_2.F(1): remark #5082: Directive ignored - Syntax error, found END-OF-STATEMENT when expecting one of: :: , : ]
!DIR$ ATTRIBUTES FORCEINLINE
----------------------------^
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWN9z2jgQ_mvEyw4eWf4R-4EHGqCTmWt6k3L3eiPLa1utkRhJLu1_fyPbEEITEpLc9OEYMImQ9tv9_O1qZW6trBXijCQfSLKY8M412sx0o_S0-jopdPlzRlI6vumC0PnfaKzUCnQFVctVPVW4AxLNIcwDGlDCsquIVnGeiTwNK5anechTmlCWVXkRijItc2QRi1NKWD6YHK8PcYbrukGodNvqnVQ1SAsctkbXhm9gJ10DpTQonPyOQFjm17JwcXMHhMXz9fru5sNf6-UXWH2-u17e3P5xc7skA2w0PwYJA_gVR4HQxhuHEq0wcuukVvcLHzoLAy5hMTyO6xnyJNmueNRATyVsubFowTV4FBhXJRi0XessSAUkpde6a0tQ2g0LSEoBjdEmOA6KPR6UVJeE9Wxc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