3 ! Test that pr72832 is fixed now.
4 ! Contributed by Daan van Vugt
6 program allocate_source
10 type, extends(t) :: tt
18 subroutine test_class()
19 class(t), allocatable, dimension(:) :: a, b
22 if (size(a) /= 2) STOP 1
23 if (any(a(:)%i /= [ 1,2])) STOP 2
25 allocate(b(1:4), source=a)
26 ! b is incorrectly initialized here. This only is diagnosed when compiled
27 ! with -fcheck=bounds.
28 if (size(b) /= 4) STOP 3
29 if (any(b(1:2)%i /= [ 1,2])) STOP 4
30 select type (b1 => b(1))
38 subroutine test_type()
39 type(t), allocatable, dimension(:) :: a, b
41 if (size(a) /= 2) STOP 6
43 allocate(b(1:4), source=a)
44 if (size(b) /= 4) STOP 7
46 end program allocate_source