gcc/testsuite/gfortran.dg/class_allocate_22.f90
raw| 1 | ! { dg-do run } |
| 2 | ! |
| 3 | ! Check pr57117 is fixed. |
| 4 | |
| 5 | program pr57117 |
| 6 | implicit none |
| 7 | |
| 8 | type :: ti |
| 9 | integer :: i |
| 10 | end type |
| 11 | |
| 12 | class(ti), allocatable :: x(:,:), y(:,:) |
| 13 | integer :: i |
| 14 | |
| 15 | allocate(x(2,6)) |
| 16 | select type (x) |
| 17 | class is (ti) |
| 18 | x%i = reshape([(i,i=1, 12)],[2,6]) |
| 19 | end select |
| 20 | allocate(y, source=transpose(x)) |
| 21 | |
| 22 | if (any( ubound(y) /= [6,2])) STOP 1 |
| 23 | if (any(reshape(y(:,:)%i, [12]) /= [ 1,3,5,7,9,11, 2,4,6,8,10,12])) STOP 2 |
| 24 | deallocate (x,y) |
| 25 | end |
| 26 |