aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr82253.f90
blob: 4dc681012a0f98d3c81c1190b5cacbc546396a73 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
! PR middle-end/82253
! { dg-do compile { target fortran_real_16 } }
! { dg-options "-Og" }

module pr82253
  implicit none
  private
  public :: static_type
  type, public :: T
    procedure(), nopass, pointer :: testProc => null()
  end type
  type, public :: S
    complex(kind=16), pointer :: ptr
  end type
  type(T), target :: type_complex32
  interface static_type
    module procedure foo
  end interface
  interface
    subroutine bar (testProc)
      procedure(), optional :: testProc
    end subroutine
  end interface
  contains
    function foo (self) result(res)
      complex(kind=16) :: self
      type(T), pointer :: res
      call bar (testProc = baz)
    end function
    subroutine baz (buffer, status)
      character(len=*) :: buffer
      integer(kind=4) :: status
      complex(kind=16), target :: obj
      type(S) :: self
      integer(kind=1), parameter :: zero(storage_size(obj)/8) = 0
      obj = transfer (zero, obj)
      self%ptr => obj
      write (buffer, *, iostat=status) self%ptr, '#'
    end subroutine
end module pr82253