<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/128607>128607</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error for the same type of two data elements declared with reference to the same derived type definition
</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 : 21.0.0(f75126eeabba13ce2aab53c2e4296fca12b9da0d)/AArch64
```
The attached program has the same `derived type (ty)` definitions in the `specification-part` and `module-subprogram-part` in `module`, and data elements declared with reference to these `derived types`.
The data elements are of the same type, as described in `Fortran standard 2023: 7.5.2.4 Determination of derived types`.
So this program seems to be correct, but it results in a compilation error.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
sngg430l_32.f90:
```fortran
module m
type ty
integer::x
end type ty
interface assignment(=)
procedure operator_overload
end interface assignment(=)
contains
subroutine operator_overload(t1,p1)
type ty
integer::x
end type ty
type(ty),intent(inout)::t1
integer,intent(in)::p1
t1%x=p1
write(6,*) "t1%x = ", t1%x, " p1 = ", p1
end subroutine operator_overload
end module m
program main
use m
integer::x
type(ty)::obj
x=10
obj= x
write(6,*) "obj%x = ", obj%x
if(obj%x .ne. 10)print*,"100"
print*,"pass"
end program main
```
```
$ flang sngg430l_32.f90
error: Semantic errors in sngg430l_32.f90
./sngg430l_32.f90:25:3: error: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(ty) and INTEGER(4)
obj= x
^^^^^^
$
```
```
$ gfortran sngg430l_32.f90
sngg430l_32.f90:25:7:
25 | obj= x
| 1
Error: Cannot convert INTEGER(4) to TYPE(ty) at (1)
$
```
```
$ ifx sngg430l.f90_32; ./a.out
t1%x = 10 p1 = 10
obj%x = 10
pass
$
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVklv47gS_jX0hYhAlRb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