PR ipa/83051
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_comp_13.f90
blobafc8f55b5d3b66da413c6923ed4b1842ada8d333
1 ! { dg-do run }
3 ! PR 40882: [F03] infinite recursion in gfc_get_derived_type with PPC returning derived type.
4 ! At the same time, check that a formal argument does not cause infinite recursion (PR 40870).
6 ! Contributed by Janus Weil <janus@gcc.gnu.org>
8 implicit none
10 type :: t
11 integer :: data
12 procedure(foo), pointer, nopass :: ppc
13 procedure(type(t)), pointer, nopass :: ppc2
14 end type
16 type(t) :: o,o2
18 o%data = 1
19 o%ppc => foo
21 o2 = o%ppc(o)
23 if (o%data /= 1) call abort()
24 if (o2%data /= 5) call abort()
25 if (.not. associated(o%ppc)) call abort()
26 if (associated(o2%ppc)) call abort()
28 contains
30 function foo(arg)
31 type(t) :: foo, arg
32 foo%data = arg%data * 5
33 foo%ppc => NULL()
34 end function
36 end