summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/class_allocate_22.f90
blob: 589548d58a22de7ba32cf28ee925f4ad5b7ec50c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
! { dg-do run }
!
! Check pr57117 is fixed.

program pr57117
  implicit none

  type :: ti
    integer :: i
  end type

  class(ti), allocatable :: x(:,:), y(:,:)
  integer :: i

  allocate(x(2,6))
  select type (x)
    class is (ti)
       x%i = reshape([(i,i=1, 12)],[2,6])
  end select
  allocate(y, source=transpose(x))

  if (any( ubound(y) /= [6,2])) STOP 1
  if (any(reshape(y(:,:)%i, [12]) /= [ 1,3,5,7,9,11, 2,4,6,8,10,12])) STOP 2
  deallocate (x,y)
end