<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62599>62599</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] Incorrect execution result of variable in subroutine using INTERFACE ASSIGNMENT(=)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 17.0.0(5a50ba03e9adb1614189530f8a5ef06d90dfd670)
```
The variable a2 in subroutine x using `INTERFACE ASSIGNMENT(=)` appears to be handled incorrectly.
The value of the variable a2 in subroutine x expects 1, but is actually 11 for flang and gfortran.
The following are the test program, results of flang-new, gfortran and ifort compilation and execution.
snggf232_5.f90:
```fortran
module m1
interface assignment(=)
module procedure x
end interface assignment(=)
integer::aa=1
contains
subroutine x(a1,a2)
character,intent(out)::a1
integer,intent(in)::a2
write(6,*) "subroutine : a2 = ", a2, ", aa = ", aa
aa=11
write(6,*) "subroutine : a2 = ", a2, ", aa = ", aa
if (a2 .eq. 1) then
a1 = '1'
end if
write(6,*) "subroutine : a1 = ", a1
end subroutine x
end module m1
program main
use m1
character:: a
a=aa
write(6,*) "main : a = ", a, ", aa = ", aa
if (any(a/=(/'1'/))) write(6,*) "NG"
if (any(aa/=(/11/))) write(6,*) "NG"
end program main
```
```
$ flang-new -flang-experimental-exec snggg232_5.f90; ./a.out
subroutine : a2 = 1 , aa = 1
subroutine : a2 = 11 , aa = 11
subroutine : a1 = ^@
main : a = , aa = 11
NG
$
```
```
$ gfortran snggg232_5.f90; ./a.out
subroutine : a2 = 1 , aa = 1
subroutine : a2 = 11 , aa = 11
subroutine : a1 = ^@
main : a = ^@, aa = 11
NG
$
```
```
$ ifort snggg232_5.f90; ./a.out
subroutine : a2 = 1 , aa = 1
subroutine : a2 = 1 , aa = 11
subroutine : a1 = 1
main : a = 1, aa = 11
$
```
</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