aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/recursive_check_16.f90
blob: d8e9d69ea7b82e1ae85b2839f04c0d8a545428a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
! { dg-do  run }
! ! { dg-options "-fcheck=recursion" }
! PR 95743 - this used cause a runtime error.
! Test case by Antoine Lemoine

program test_recursive_call
   implicit none

   type t_tree_node
      type(t_tree_node), dimension(:), allocatable :: child
   end type

   type t_tree
      type(t_tree_node), allocatable :: root
   end type

   type(t_tree), allocatable :: tree

   allocate(tree)
   allocate(tree%root)
   allocate(tree%root%child(1))
   ! If the line below is removed, the code works fine.
   allocate(tree%root%child(1)%child(1))
   deallocate(tree)
end program