view gcc/testsuite/gfortran.dg/proc_ptr_51.f90 @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

! { dg-do run }
!
! Test the fix for PR90786.
!
! Contributed by Andrew benson  <abensonca@gmail.com>
!
module f
procedure(c), pointer :: c_

 type :: s
   integer :: i = 42
 end type s
 class(s), pointer :: res, tgt

contains

 function c()
   implicit none
   class(s), pointer ::  c
   c => tgt
   return
 end function c

 subroutine fs()
   implicit none
   c_ => c  ! This used to ICE
   return
 end subroutine fs

end module f

  use f
  allocate (tgt, source = s(99))
  call fs()
  res => c_()
  if (res%i .ne. 99) stop 1
  deallocate (tgt)
end