-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Labels
Description
Consider the following code:
module m
type base
sequence
integer(4) :: id
character(200) :: name
end type
end module
program fdtioC936_001
interface write(formatted)
subroutine formattedWrite (dtv, unit, iotype, v_list, iostat, iomsg)
use m
type (base), intent(in) :: dtv
integer, intent(in) :: unit
character(*), intent(in) :: iotype
integer, intent(in) :: v_list(:)
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
end subroutine
end interface
type base
sequence
integer(4) :: id
character(200) :: name
end type
type (base) b1
b1 = base(100, 'xlftest 101')
write (6, *) b1
close(1)
end
subroutine formattedWrite (dtv, unit, iotype, v_list, iostat, iomsg)
use m
type (base), intent(in) :: dtv
integer, intent(in) :: unit
character(*), intent(in) :: iotype
integer, intent(in) :: v_list(:)
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
write (unit, '(i5, a20)', iostat = iostat, iomsg = iomsg) dtv%id+1, dtv%name
end subroutine
Flang failed to recognize that b1
has the same type as dtv
in the DTIO procedure.
The execution outputs
100 xlftest 101
The expected output is
101 xlftest 101
If I remove the sequence type base
in the main program and use the one in the module instead, Flang runs successfully.