<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88678>88678</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error when a function defined in module and a statement function used in an internal subroutine have the same name
</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(4f19f15a601a5761b12c9c66d99d97dbc89ef90d)/AArch64
```
When a function defined in `module` and a `statement function` used in an `internal subroutine` have the same name, a compilation error occurs.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
sngg657d_2.f90:
```fortran
module m1
contains
function ifun() result(r)
r=0
end function ifun
end module m1
program main
use m1
call test03
print *,'pass'
contains
subroutine test03()
ifun()=1
if (ifun()/=1) print *,101
end subroutine test03
end program main
```
```
$ flang-new sngg657d_2.f90; ./a.out
error: Semantic errors in sngg657d_2.f90
./sngg657d_2.f90:14:5: error: 'ifun' has not been declared as an array or pointer-valued function
ifun()=1
^^^^
$
```
```
$ gfortran sngg657d_2.f90; ./a.out
pass
$
```
```
$ ifort -diag-disable=10448 sngg657d_2.f90; ./a.out
pass
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVc2O4zYMfhrlQiSQ6b_4kEN2pu4DtGiPBS3JthayFEjyTPftC9nOJJvMomixQOCAlMhP_ER-ohD0YJU6sfILK193NMfR-ZMbrdv3X3edk99OrOLbj78yfv5D-aCdBddDb8gOe6vegeVnyJoDP3CGx6LPmj4rqeIZlXWVdRmKRlSVbBrZ1LITx0b1DZcMG4bt-ezFWBVr8ges9fvnqCwQ9LMVMSFL1WurJGgLrOKTk7NRrOJAVgIlV4gU1aRs_IhJy3NYY2gJ0zYqb8lAmDvv5qjtkmOkNwVxVBBoUmBpUgxfgEC46aINLfjKe-fBCTH7cLg_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