| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fdump-tree-original" } |
| 3 |
! PR fortran/93834 - ICE in trans_caf_is_present |
| 4 |
|
| 5 |
program p |
| 6 |
type t |
| 7 |
integer, allocatable :: x[:,:,:] |
| 8 |
end type t |
| 9 |
integer, allocatable :: a[:] |
| 10 |
type(t) :: c |
| 11 |
if (allocated (a)) stop 1 |
| 12 |
if (allocated (c%x)) stop 2 |
| 13 |
|
| 14 |
! The coindexed scalar (!) variable is regarded as allocatable but |
| 15 |
! we can check the value on any image of the team as they are |
| 16 |
! established collectively. As tested by the dump, we do it on |
| 17 |
! this_image (). |
| 18 |
! |
| 19 |
! For this reason, -fcoarray=single and -fcoarray=lib give the |
| 20 |
! same result |
| 21 |
if (allocated (a[1])) stop 3 |
| 22 |
if (allocated (c%x[1,2,3])) stop 4 |
| 23 |
|
| 24 |
! Allocate collectively |
| 25 |
allocate(a[*]) |
| 26 |
allocate(c%x[4,10,*]) |
| 27 |
|
| 28 |
if (.not. allocated (a)) stop 5 |
| 29 |
if (.not. allocated (c%x)) stop 6 |
| 30 |
if (.not. allocated (a[1])) stop 7 |
| 31 |
if (.not. allocated (c%x[1,2,3])) stop 8 |
| 32 |
|
| 33 |
! Deallocate collectively |
| 34 |
deallocate(a) |
| 35 |
deallocate(c%x) |
| 36 |
|
| 37 |
if (allocated (a)) stop 9 |
| 38 |
if (allocated (c%x)) stop 10 |
| 39 |
if (allocated (a[1])) stop 11 |
| 40 |
if (allocated (c%x[1,2,3])) stop 12 |
| 41 |
end |
| 42 |
|
| 43 |
! Expected: always local access and never a call to _gfortran_caf_get |
| 44 |
! { dg-final { scan-tree-dump-not "caf_get " "original" } } |
| 45 |
! { dg-final { scan-tree-dump-not "caf_get_by_" "original" } } |