[Bug fortran/77657] New: link error with implementation of user-defined derived type input/output (UD-DTIO) in child extending abstract parent
damian at sourceryinstitute dot org
gcc-bugzilla@gcc.gnu.org
Tue Sep 20 07:38:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77657
Bug ID: 77657
Summary: link error with implementation of user-defined derived
type input/output (UD-DTIO) in child extending
abstract parent
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: damian at sourceryinstitute dot org
Target Milestone: ---
It appears there might be a problem with linking an abstract interface in the
module of a parent type with a child type in another module:
$ cat ud-dtio-abstract.f90
MODULE abstract_parent
implicit none
type, abstract :: parent
contains
procedure(write_formatted_interface), deferred :: write_formatted
generic :: write(formatted) => write_formatted
end type parent
abstract interface
subroutine write_formatted_interface(this,unit,iotype,vlist,iostat,iomsg)
import parent
class(parent), intent(in) :: this
integer, intent(in) :: unit
character (len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character (len=*), intent(inout) :: iomsg
end subroutine
end interface
end module
module child_module
use abstract_parent, only : parent
implicit none
type, extends(parent) :: child
contains
procedure :: write_formatted
end type
contains
subroutine write_formatted(this,unit,iotype,vlist,iostat,iomsg)
class(child), intent(in) :: this
integer, intent(in) :: unit
character (len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character (len=*), intent(inout) :: iomsg
end subroutine
end module
use child_module, only : child
implicit none
write(*,*) child()
$ gfortran ud-dtio-abstract.f90
/tmp/ccOmINhD.o: In function `MAIN__':
ud-dtio-abstract.f90:(.text+0xac): undefined reference to
`write_formatted_interface_'
collect2: error: ld returned 1 exit status
$ gfortran --version
GNU Fortran (GCC) 7.0.0 20160904 (experimental)
More information about the Gcc-bugs
mailing list