Description
Consider the following reducer:
module m1
type :: base
! empty type
end type
interface read(unformatted)
subroutine readUnformattedbase (dtv, unit, iostat, iomsg)
import base
class(base), intent(inout) :: dtv
integer, intent(in) :: unit
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
end subroutine
end interface
interface write(unformatted)
subroutine writeUnformattedbase (dtv, unit, iostat, iomsg)
import base
class(base), intent(in) :: dtv
integer, intent(in) :: unit
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
end subroutine
end interface
end module
program test
use m1
type(base), allocatable :: b1
allocate ( b1 )
open ( 2, file = 'test.data', form='unformatted', access='sequential' )
inquire ( iolength = length1 ) b1
close ( 2, status ='delete' )
end program
There is not READ or WRITE in the code, but Flang has
ld: 0711-317 ERROR: Undefined symbol: readunformattedbase_
ld: 0711-317 ERROR: Undefined symbol: writeunformattedbase_
Further more, if I provide the following implementation of the DTIO routines,
subroutine readUnformattedbase (dtv, myunit, iostat, iomsg)
use m1, only: base
class(base), intent(inout) :: dtv
integer, intent(in) :: myunit
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
integer :: length1
select type (dtv)
type is (base)
inquire ( iolength = length1 ) dtv
end select
end subroutine
subroutine writeUnformattedbase (dtv, myunit, iostat, iomsg)
use m1, only: base
class(base), intent(in) :: dtv
integer, intent(in) :: myunit
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
integer :: length1
select type (dtv)
type is (base)
inquire ( iolength = length1 ) dtv
end select
end subroutine
Flang coredumps at runtime at the inquire
statement
fatal Fortran runtime error(t.f:39): Defined unformatted I/O without an external unit
IOT/Abort trap(coredump)
All ifort, gfortran and XLF compiles and executes the code successfully.