<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/133671>133671</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error of interface and end interface statement with read (formatted) as defined-io-generic-spec
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang : 21.0.0(b2b3cb5f76f15d38e67f70124d275a5696bfdb83)/AArch64
```
`interface and end interface statement` with `read (formatted)` as `defined-io-generic-spec` fails the linker command.
When `read (formatted)` is removed from `interface and end interface statement`, the compilation is successful.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
sngg521n_21.f90:
```fortran
PROGRAM MAIN
TYPE T
INTEGER::A
END TYPE T
INTERFACE READ(FORMATTED)
SUBROUTINE SUB1 (DTV, UNIT, IOTYPE, V_LIST, IOSTAT, IOMSG)
IMPORT T
CLASS(T), INTENT(INOUT) :: DTV
INTEGER, INTENT(IN) :: UNIT
CHARACTER(LEN=*), INTENT(IN) :: IOTYPE
INTEGER, INTENT(IN) :: V_LIST (:)
INTEGER, INTENT(OUT) :: IOSTAT
CHARACTER(LEN=*), INTENT(INOUT) :: IOMSG
END SUBROUTINE SUB1
END INTERFACE READ(FORMATTED)
print *,'pass'
END PROGRAM MAIN
```
```
$ flang sngg521n_21.f90
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/aarch64-redhat-linux/12/../../../../bin/ld: /tmp/sngg521n_21-1789ed.o:(.data.rel.ro._QFEXsXt[_QFEXsXt]+0x8): undefined reference to `sub1_'
flang-20: error: linker command failed with exit code 1 (use -v to see invocation)
$
```
```
$ gfortran sngg521n_21.f90; ./a.out
pass
$
```
```
$ ifx sngg521n_21.f90; ./a.out
pass
$
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVU1zozgQ_TXyRQU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