Debian Codegraph @

gcc/testsuite/gfortran.dg/recursive_alloc_comp_5.f90

raw
1 !{ dg-do run }
2
3 ! Check that PR106606 is fixed.
4
5 ! Contributed by Ron Shepard <[email protected]>
6
7 module bst_base_mod
8
9 ! Binary Search Tree Module
10
11 implicit none
12
13 public
14
15 type, abstract :: bst_base_node_type
16 class(bst_base_node_type), allocatable :: left
17 class(bst_base_node_type), allocatable :: right
18 end type bst_base_node_type
19
20 type, extends (bst_base_node_type) :: bst_base
21 integer :: bst_base_value
22 end type bst_base
23
24 end module bst_base_mod
25
26 use bst_base_mod
27
28 class (bst_base), allocatable :: root
29
30 allocate (root, source = bst_base (NULL(), NULL(), 0))
31 root%left = bst_base (NULL(), NULL(), 1)
32 root%right = bst_base (NULL(), NULL(), 2)
33
34 if (.not. allocated(root%left)) stop 1
35 if (.not. allocated(root%right)) stop 2
36 end
37