<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108897>108897</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] The value of data-pointer-object associated with data-target is incorrect
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 20.0.0(1cc4c87198ec0c6febca3f6ed03357e9e091cfd4)/AArch64
```
In the attached program, the value of `data-pointer-object (p)` associated with `data-target (r)` is incorrect.
The value of `p` is expected to be 1.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
snggt568_2.f90:
```fortran
module m1
integer,pointer::p
contains
subroutine s1()
print *,associated(p)
print *,f()
print *,associated(p)
print *,p
end subroutine s1
function f() result(r)
integer,target,allocatable::r
allocate(r)
p=>r
p=1
end function f
end module m1
program main
use m1
call s1()
print *,'pass'
end program main
```
```
$ flang-new snggt568_2.f90; ./a.out
F
1
T
-1431481645
pass
$
```
```
$ gfortran snggt568_2.f90; ./a.out
F
1
T
-2101974626
pass
$
```
```
$ ifort -diag-disable=10448 snggt568_2.f90; ./a.out
F
1
T
1
pass
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslc2O5CYQx5-GvqC2oIy_Dj70zsRR7qtcI4zLblY0WIBnNm8f4Y90T-8cstqMRqYpiqoff6CQIejJIrak-EKK15Nc4tX51l2tO4_fTr0b_m5JyfZ_9krY5U_0QTtL3UhHI-10tvhOSX6hwDKWMQI1V0qouuJNjYqpcsReyXwscWB5XlTYIGu4GgdBoCHQXS5eXUuxBX_KtX3_sDRekcoYpbriQGfvJi9vBF5W-5s0CyYcUrJBRnmenbYR_dn131BFSqCeU6qSURmCU1pGHOi7jtd_Z0TpJ1w9_e6pA9VWOe9RxYzSDeTrU7Z598TvM6oUNDraI-XZI32aNDpj3Lu2E5UeV-iIIT4upDukTJ3fR-ejl5ZKO1CdOlS526yNjNpZAh1-R7Wk39RjWEz8kDDYaYpFWf8F2dgwkl-epN2Db9abGxaD9Ma3LqVJugk9gZddxhQgv8zbuHI2Sm3D4R2W3rslaos0cAJ1Um8fonT22iZRLwRe7sof2_Gp2_g_xJgPM9rhCXAfGBerVvX2dLuKx_ZvXnchttORAIxxSkbZG9xU8XeCfQw_BkloJH8l-W_-o-VgSYwPOKsx2Z72Zfvu54XepLZHuCU87p6SxvywE4_iEKhmGQKB6p7rx7CfXsNnI4iHAvB86L7QjEAnM7fEHaPb24P1696euci5qHkpit2yAh45fg5oOm7OL_AAZ7ypRAnlr_Nsl_c8aDmdBx22k_PKmRD1TyDe_55h-X9GPA1tPjR5I0_Y8grKAipR5adriz1X5djnApuq5n2FIJqajcOYCxD1WJx0CwwEa3gJUFRFnmFf1lBVvazHYqybgQiGN6lNZszbLXN-OukQFmw5q-umOhnZownrCwOwnhgCkB4b36YJ536ZAhHM6BDDPUTU0azP0loZSfFKP1Tfzwr9c3V_LO2P9fy0eNNeY5xDusXQEegmHa9Lnyl3I9Alhr05z96l2AS6dU2BQLcv662FfwIAAP__vywMeg">