Issue 108897
Summary [Flang] The value of data-pointer-object associated with data-target is incorrect
Labels flang
Assignees
Reporter ohno-fj
    ```
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
$
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to