This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: DWARF debug tags for gfortran's OOP implementation

Dear all,

during the GCC Gathering I realized during the LTO debugging symbol discussion that gfortran does not generate debug information for the OOP features (cf. PR 49475).

The first issue to solve is which DWARF information one should generate. I have only very limited knowledge of DWARF, except that I quickly scanned "5.5.3 Derived or Extended Structs, Classes and Interfaces" and "5.5.7 Member Function Entries" (of

I think one should handle member functions (cf. example below). I am not sure whether other things like type extension or accessibility should be handled.


! Example

module m
  implicit none

  type parent
    integer :: var_p = 3
    procedure, nopass :: memb => proc_parent
  end type parent
  ! Side note: nopass disables passing of the type itself ("this")
  ! Otherwise, the effective type would be passed as first argument to
  ! proc_parent

  type, extends(parent) :: child
    procedure, nopass :: memb => proc_child
  end type child

  subroutine proc_parent()
     print *, "proc_parent"
  end subroutine proc_parent

  subroutine proc_child()
     print *, "proc_child"
  end subroutine proc_child
end module m

program main
  use m
  implicit none
  class(parent), allocatable :: a
  type(child) :: b

  allocate (parent :: a)
  call a%memb() ! Uses vtable to see that proc_parent should be called

  deallocate (a)
  allocate (child :: a)
  call a%memb() ! Uses vtable to see that proc_child should be called

  ! Variable access - resolved at compile time
  print *, b%var_p  ! Directly access "var_p"
  print *, b%parent%var_p ! Access it via the parent type
end program main

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]