-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Labels
Description
Consider the following code (This code is updated on July 16th to include the problem with the v_list.)
module m
type base
sequence
integer(4) :: i
end type
end module
program scalar007
use m
type(base), allocatable :: b1
integer :: stat = 0
character(150) :: msg = "original"
character(30) :: fmt = "(DT(5))"
interface write(formatted)
subroutine writeformatted(dtv, unit, iotype, v_list, iostat, iomsg )
import base
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
open (1, file = 'scalar007.1', form='formatted', access='sequential' )
allocate ( b1, source = base(4) )
10 format (DT'b2'(6,7))
write ( 1, fmt, iostat = stat, iomsg = msg ) b1
end program
subroutine writeformatted (dtv, unit, iotype, v_list, iostat, iomsg)
use m!, only: base, data
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
print*, unit
write ( unit, * ) ' Data not using DTIO: v_list is:', v_list !! This line is added to illustrate the problem with v_list.
end subroutine
When compile the code with -fdefault-integer-8, Flang failed at runtime as
> a.out
4563402751
fatal Fortran runtime error(t.f:48): UNIT number 4563402751 is out of range
IOT/Abort trap(coredump)
It worked fine if I removed the -fdefault-integer-8 option.
It seems the runtime routine _FortranAioCheckUnitNumberInRange64 isn't expecting a i64 UNIT number.
Update:
When compile without -fdefault-integer-8, the output file scalar007.1 contains
Data not using DTIO: v_list is: 5
When compile with -fdefault-integer-8, the output file scalar007.1 contains
Data not using DTIO: v_list is: 21474836480