Debian Codegraph @

gcc/testsuite/gfortran.dg/proc_ptr_51.f90

raw
1 ! { dg-do run }
2 !
3 ! Test the fix for PR90786.
4 !
5 ! Contributed by Andrew benson <[email protected]>
6 !
7 module f
8 procedure(c), pointer :: c_
9
10 type :: s
11 integer :: i = 42
12 end type s
13 class(s), pointer :: res, tgt
14
15 contains
16
17 function c()
18 implicit none
19 class(s), pointer :: c
20 c => tgt
21 return
22 end function c
23
24 subroutine fs()
25 implicit none
26 c_ => c ! This used to ICE
27 return
28 end subroutine fs
29
30 end module f
31
32 use f
33 allocate (tgt, source = s(99))
34 call fs()
35 res => c_()
36 if (res%i .ne. 99) stop 1
37 deallocate (tgt)
38 end