<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82211>82211</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error when external procedure with external attribute is declared in interface statement
</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)
```
Declaring the `external procedure` name (ff1) in an `external` statement and defining it using `interface` statement results in a compilation error.
Gfortran and ifort can compile and execute successfully.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
snggn164_32.f90:
```fortran
subroutine sub(ff1)
interface aaa
function ff1(xxx)
integer,intent(in) :: xxx(:)
integer ff1(size(xxx))
end function ff1
end interface aaa
integer,allocatable:: x(:)
integer y(2)
allocate(x(2))
y=aaa(x)
write(6,*) "y = ", y
if(any(y/=(/(i,i=1,size(x))/)))print *,'error-1'
end subroutine sub
function ff1(xxx)
integer,intent(in) :: xxx(:)
integer ff1(size(xxx))
ff1=(/(i,i=1,size(xxx))/)
end function ff1
program main
external ff1
call sub(ff1)
print *,'pass'
end program main
```
```
$ flang-new snggn164_32.f90
error: Semantic errors in snggn164_32.f90
./snggn164_32.f90:24:12: error: The global subprogram 'ff1' may not be referenced via the implicit interface 'ff1'
external ff1
^^^
./snggn164_32.f90:16:10: Declaration of 'ff1'
function ff1(xxx)
^^^
./snggn164_32.f90:24:12: Declaration of 'ff1'
external ff1
^^^
$
```
```
$ gfortran snggn164_32.f90; ./a.out
y = 1 2
pass
$
```
```
$ ifort -diag-disable=10448 snggn164_32.f90; ./a.out
y = 1 2
pass
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vt3S4igQfRq8oUyRJsbkwgtH132A3drbLZJ0IlMELCDz6T79FiRq_Kn5Zu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