<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/138807>138807</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] About using names with multiple declarations (intrinsic statement, interface block, derived type) in a program
</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 : 20.0.0(842e5915778a820c63cf38b75bec932a6ea8c18b)/AArch64
```
In the attached program, this program has three declarations using `name (int)`:
- `intrinsic statement`
`intrinsic-procedure-name-list` is defined as `intrinsic function (int)`.
- `generic-spec of interface block`
`external procedure (ifunc01)` is defined as `generic specification (int)`.
- `derived-type definition`
`type-name` is defined as a `derived type (int)`.
Is this confusing usage incorrect?
I checked `Fortran standard 2023` and could not see if this program is incorrect.
Currently, Flang and Gfortran seem to recognize that `intrinsic statement` is valid and `name (int)` is an `int intrinsic function`.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
snf_fsstc_19_23.f90:
```fortran
program main
intrinsic :: int
interface int
function ifunc01(if01_arg01, if01_arg02) result(irst01)
integer :: if01_arg01
integer :: if01_arg02
integer :: irst01
end function ifunc01
end interface int
type int
real :: ti1_r01
end type int
type (int) ::aaa
aaa=int(1)
! if (aaa%ti1_r01.ne.1) print *,'err'
! if (int(2,1).ne.2) print *,'err'
print *,'pass'
end program main
function ifunc01(if01_arg01, if01_arg02) result(irst01)
integer :: if01_arg01
integer :: if01_arg02
integer :: irst01
irst01 = int(if01_arg01) + int(if01_arg02)
end function ifunc01
```
```
$ flang snf_fsstc_19_23.f90
error: Semantic errors in snf_fsstc_19_23.f90
./snf_fsstc_19_23.f90:14:3: error: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(int) and INTEGER(4)
aaa=int(1)
^^^^^^^^^^
$
```
```
$ gfortran snf_fsstc_19_23.f90
snf_fsstc_19_23.f90:14:6:
14 | aaa=int(1)
| 1
Error: Cannot convert INTEGER(4) to TYPE(int) at (1)
$
```
```
$ ifx snf_fsstc_19_23.f90; ./a.out
pass
$
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVk-P27gP_TTKhUggy7FjH3JwM5NiDr_BD9vBAnsaKDIdq3WkQJKn7X76BWXnf5ruYYMAiU3q8Yl8lCi911uDuGTZJ5Y9TWQfWuuWtjV22nydbGz9c8lyPn559Sc6r60B20DTSbMFllYg-IzPOBNFMReYlUm2WBSyEFzlqWrSYrPINqjKVMgcZaGSYsNEycS6qpxq8znj1XkExqsXA6FFkCFI1WINe2e3Tu6YWEFotT88Qys9hNYhQo2qk04GbY2H3msilnMjdwhMFNoEiphzlhI8TMmoTXDaeK3ABxlwhyawnAOQQ_yc-0z3ziqse4dTAp122kdv7aHGRhusQfpL1KY3ivhcEJgdw2_RoNNq6veoKJvaBHSNVAibzqpvRyos5_gjoDOygyOJiEkBeDLg3hIZ8YHwdaOVfMClRqc_sJ6Gn3scYDR536SD7HH_txHlGQ5EnOtQVFc_1E9Z0wxF6r3cImijrHOoAkvXMeILqBbVN6wJdW1dcNJQmUwtXQ2Ci5QYSFODsn1Xg7EBPCLo5lIg2p-wZxF51TuHJnQ_SUzrqGCC-dwcgiDuIFhwqOzW6L8RQivDA71oDx-y03WEuac58pBmRIBbfZzS89YiNLbr7HdKjXQYuyCgD-cdEEnTnyNniqybH6Dsbq-7WGgm1vgDVR-L7tD3XRiDeNO8N94H9Z6U7yKdNeXYFcceHGEZrw5p3Eltog5O7GlNWtGLg2FU7-ENwKkDjlItdMOTd-m29LCC45NgohxpkpPzYRD2QXsRf4vuGPYE81sXQS7XxiHCuBZNfcuVbGS42VkU99kuHcrugBt08u7OFl_4XnbFuERKSUb6SZ-ipRh3zkQCJGgmCrKKbASfGZyRC-wdCYqJiokVEwt0jonF5cIBUDCxohW0UjxaCdeWvfR-MNFuruTAePXfVPhhcR-W9UFdh7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