| 1 |
! { dg-do run } |
| 2 |
! ! { dg-options "-fcheck=recursion" } |
| 3 |
! PR 95743 - this used cause a runtime error. |
| 4 |
! Test case by Antoine Lemoine |
| 5 |
|
| 6 |
program test_recursive_call |
| 7 |
implicit none |
| 8 |
|
| 9 |
type t_tree_node |
| 10 |
type(t_tree_node), dimension(:), allocatable :: child |
| 11 |
end type |
| 12 |
|
| 13 |
type t_tree |
| 14 |
type(t_tree_node), allocatable :: root |
| 15 |
end type |
| 16 |
|
| 17 |
type(t_tree), allocatable :: tree |
| 18 |
|
| 19 |
allocate(tree) |
| 20 |
allocate(tree%root) |
| 21 |
allocate(tree%root%child(1)) |
| 22 |
! If the line below is removed, the code works fine. |
| 23 |
allocate(tree%root%child(1)%child(1)) |
| 24 |
deallocate(tree) |
| 25 |
end program |