<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/71367>71367</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error when the same subroutine name but different arugment types
</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 : 18.0.0(1c876ff5155c4feeb2b2885eb3e6abda17c4b7f4)
```
A compilation error occurs if `subroutine` with the same name is declared in `interface` and `subroutine` statements but their argument types are not the same.
When I specify `-flang-experimental-hlfir` at the compilation, I can avoid the compilation error.
The following are the test program, Flang-new, Gfortran and ifort compilation result.
gc_e157_2.f90:
```fortran
program main
interface
subroutine sub(a)
integer,dimension(3):: a
end subroutine sub
end interface
integer,dimension(3):: a
call sub(a)
end program main
subroutine sub(s)
integer,dimension(:):: s
end subroutine sub
```
```
$ flang-new gc_e157_2.f90
./gc_e157_2.f90:3:17: warning: The global subprogram 'sub' is not compatible with its local procedure declaration (incompatible dummy argument #1: incompatible dummy data object attributes)
subroutine sub(a)
^^^
./gc_e157_2.f90:12:12: Declaration of 'sub'
subroutine sub(s)
^^^
./gc_e157_2.f90:3:17: Declaration of 'sub'
subroutine sub(a)
^^^
error: loc("/work/home/ohno/CT/test/fort/tp/reproducer/Metro/gc_err/gc_e157_2.f90":9:3): 'fir.convert' op invalid type conversion
error: verification of lowering to FIR failed
$
```
```
$ flang-new gc_e157_2.f90 -flang-experimental-hlfir
./gc_e157_2.f90:3:17: warning: The global subprogram 'sub' is not compatible with its local procedure declaration (incompatible dummy argument #1: incompatible dummy data object attributes)
subroutine sub(a)
^^^
./gc_e157_2.f90:12:12: Declaration of 'sub'
subroutine sub(s)
^^^
./gc_e157_2.f90:3:17: Declaration of 'sub'
subroutine sub(a)
^^^
```
```
$ gfortran gc_e157_2.f90
gc_e157_2.f90:3:19:
3 | subroutine sub(a)
| 1
Warning: Interface mismatch in global procedure ‘sub’ at (1): Shape mismatch in argument 'a'
$
```
```
$ ifort gc_e157_2.f90
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVk2TozYT_jXypWtcIMzXwQe_M8tbc8gl2UqOW0K0QBuBXJIYZ_59qgF_e7OzlRyXcskgpH66W8_TtPBetwPilqX_Y-nLSoyhs25ru8E-qa-r2jbvW5ZFyy96YdHud3Re2wGsAmXE0D4NeACW7CAu1tE6YryIZZFnSqVxmsqNQqx5zYsixTrBTNSNiHO5qXO1YbycTd4gzOMOpO332ohAaOicdWClHJ0HrYBlkR9rZ8egB2RZBAcdOggdghc9wkCD9tCgNMJhA3qgLXoI6JSQ0w4xNPdmfBABexyCh3oMZFA7EK4daQ7C-x49CIcw2HBCWwPMLv_R4QCv4PcotXon409zivCvPTpNJoR56ozSbnJgNnERJuPP8ApSDCDerG5uX89ZWF9maR4_dwjKGmMPemgn_2hnQB9g72zrRE-Wq-Nx0cP_lXXBEdLQgKaHKySHfjThCqqVXzBO8y98rcqIJbubs1vszbMLKvRCLzMA5-QvEwBwTj7dMl6IEylgvmhXi47x54YS6KcsFQktS3ZEO3GxHIfm1uTykt7cOHDp18cQpDDmzk-yfB_uPN6F5y_Ce4xLmCdkf4Z4FNZD3dxO8s2FTq_PcFqwZry6PdqEJbs4Jw8Owg16aOmWSNYaW4spB8eQGc-n0HKSG6mCWCSCrg3OmtTBg7FSGMqSxGZ0uMhyZhrjhR4uNjVj37-fJcd4EhP6gzWNCAJs_RVlABGC0_UY0N8S6PsUu7hY-mn5fTM3MT8O8HIRhlXnVByt_-Px_xjq-US-B_qvg56KDCEZK4mQnDNeHaz7k_Gqsz0yXtH3gfHq-TPjFVUZxiuSPz3tGa8c7p1tRknkrn7B4OwSkXN3oXHKZDlFONGeAlLaraUd3pBM5mD3oIc3Yaggvu-pItKrSS_XDr-h00rLU26MPaCjihgsVK-_ghLaYHMlFr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