gcc/testsuite/gfortran.dg/derived_init_5.f90
raw| 1 | ! { dg-do run } |
| 2 | ! PR 59781 - this was not initialized correctly before. |
| 3 | ! Original test case by James Spencer. |
| 4 | implicit none |
| 5 | |
| 6 | type t1 |
| 7 | integer :: s |
| 8 | end type |
| 9 | |
| 10 | type t2 |
| 11 | type(t1) :: state = t1(1) |
| 12 | real, allocatable :: store(:) |
| 13 | end type |
| 14 | |
| 15 | call test |
| 16 | |
| 17 | contains |
| 18 | |
| 19 | subroutine test |
| 20 | type(t2) :: rng |
| 21 | if (rng%state%s /= 1) STOP 1 |
| 22 | end subroutine |
| 23 | |
| 24 | end |