PR tree-optimization/86415 - strlen() not folded for substrings within constant arrays
[official-gcc.git] / gcc / testsuite / gfortran.dg / coarray_allocate_3.f08
blob3d116d22af862c124aae15fbbbff820a56b49944
1 ! { dg-do run }
2 ! { dg-options "-fcoarray=single" }
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
7 ! PR fortran/67451
9   program main
10     implicit none
11     type foo
12       integer :: bar = 99
13     end type
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)) STOP 1
21     if (lbound(foobar, 1) /= 1 .OR. ubound(foobar, 1) /= 10) STOP 2
22     if (.not. allocated(some_local_object)) STOP 3
23     if (any(some_local_object(:)%bar /= [99, 99,  99, 99, 99, 99, 99, 99, 99, 99])) STOP 4
25     deallocate(some_local_object)
26     deallocate(foobar)
27   end program