gcc/testsuite/gfortran.dg/PR100245.f90
raw| 1 | ! { dg-do run } |
| 2 | ! |
| 3 | ! Test the fix for PR100245 |
| 4 | ! |
| 5 | |
| 6 | program main_p |
| 7 | |
| 8 | implicit none |
| 9 | |
| 10 | type :: foo_t |
| 11 | integer :: a |
| 12 | end type foo_t |
| 13 | |
| 14 | integer, parameter :: a = 42 |
| 15 | |
| 16 | class(foo_t), allocatable :: val |
| 17 | class(foo_t), allocatable :: rs1 |
| 18 | type(foo_t), allocatable :: rs2 |
| 19 | |
| 20 | allocate(val, source=foo_t(42)) |
| 21 | if (val%a/=a) stop 1 |
| 22 | rs1 = val |
| 23 | if (rs1%a/=a) stop 2 |
| 24 | rs2 = val |
| 25 | if (rs2%a/=a) stop 3 |
| 26 | deallocate(val, rs1, rs2) |
| 27 | |
| 28 | end program main_p |