2 ! { dg-options "-fdefault-integer-8 -O2" }
3 ! Tests the fix for PR34143, where the implicit type
4 ! conversion in the derived type constructor would fail,
5 ! when 'yy' was not allocated. The testscase is an
6 ! extract from alloc_comp_constructor.f90.
8 ! Reported by Thomas Koenig <tkoenig@gcc.gnu.org>
10 Program test_constructor
16 integer(4), allocatable :: a(:, :)
17 type(thytype), allocatable :: q(:)
19 integer, allocatable :: yy(:,:)
20 type (thytype), allocatable :: bar(:)
27 if (allocated (x%a) .or. allocated (x%q)) call abort
28 end subroutine non_alloc
33 yy = reshape ([10,20,30,40],[2,2])
34 bar = thytype (reshape ([1,2,3,4],[2,2]))
36 if (.not.allocated (x%a) .or. .not.allocated (x%q)) call abort
38 end program test_constructor