| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fcoarray=lib -fdump-tree-original" } |
| 3 |
! |
| 4 |
! Test that the compiler generates sync_all statements only at the required |
| 5 |
! locations. This program is not supposed to run (allocating already alloced). |
| 6 |
|
| 7 |
program test_alloc_sync |
| 8 |
|
| 9 |
type :: T |
| 10 |
integer, allocatable :: i |
| 11 |
end type T |
| 12 |
type :: T2 |
| 13 |
type(T), allocatable :: o[:] |
| 14 |
end type T2 |
| 15 |
|
| 16 |
integer, allocatable :: caf[:] |
| 17 |
type (T) :: obj[*] |
| 18 |
type (T2) :: cafcomp |
| 19 |
|
| 20 |
allocate(caf[*]) ! implicit sync_all |
| 21 |
allocate(obj%i) ! asynchronous |
| 22 |
allocate(cafcomp%o[*]) ! sync |
| 23 |
allocate(cafcomp%o%i) ! async |
| 24 |
|
| 25 |
allocate(obj%i, cafcomp%o%i) ! async |
| 26 |
allocate(caf[*], obj%i, cafcomp%o%i) ! sync |
| 27 |
|
| 28 |
end program test_alloc_sync |
| 29 |
|
| 30 |
! { dg-final { scan-tree-dump-times "caf_sync_all" 3 "original" } } |