2 ! { dg-options "-fcoarray=lib -lcaf_single -fdump-tree-original" }
4 ! Contributed by Ian Harvey <ian_harvey@bigpond.com>
5 ! Extended by Andre Vehreschild <vehre@gcc.gnu.org>
6 ! to test that coarray references in allocate work now
14 class(foo), dimension(:), allocatable :: foobar[:]
15 class(foo), dimension(:), allocatable :: some_local_object
16 allocate(foobar(10)[*])
18 allocate(some_local_object, source=foobar)
20 if (.not. allocated(foobar)) call abort()
21 if (lbound(foobar, 1) /= 1 .OR. ubound(foobar, 1) /= 10) call abort()
22 if (.not. allocated(some_local_object)) call abort()
23 if (any(some_local_object(:)%bar /= [99, 99, 99, 99, 99, 99, 99, 99, 99, 99])) call abort()
25 deallocate(some_local_object)
29 ! Check that some_local_object is treated as rank-1 array.
30 ! This failed beforehand, because the coarray attribute of the source=expression
31 ! was propagated to some_local_object in the allocate.
32 ! { dg-final { scan-tree-dump-not "some_local_object\._data\.dim\[1\]\.lbound" "original" } }