gcc/testsuite/gfortran.dg/class_allocate_21.f90
raw| 1 | ! { dg-do run } |
| 2 | ! |
| 3 | ! Testcase for pr57117 |
| 4 | |
| 5 | implicit none |
| 6 | |
| 7 | type :: ti |
| 8 | integer :: i |
| 9 | end type |
| 10 | |
| 11 | class(ti), allocatable :: x(:,:), z(:) |
| 12 | integer :: i |
| 13 | |
| 14 | allocate(x(3,3)) |
| 15 | x%i = reshape([( i, i = 1, 9 )], [3, 3]) |
| 16 | allocate(z(9), source=reshape(x, (/ 9 /))) |
| 17 | |
| 18 | if (any( z%i /= [( i, i = 1, 9 )])) STOP 1 |
| 19 | deallocate (x, z) |
| 20 | end |
| 21 |