-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Labels
Description
Consider the following code
module m
type base (kb)
integer, kind :: kb
integer(kb) :: i
end type
interface write(formatted)
subroutine writeformatted(dtv, unit, iotype, v_list, iostat, iomsg )
import base
class(base(4)), intent(in) :: dtv ! tcx: (4)
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
end module
program scalar005kl
use m
integer :: stat
character(200) :: msg = ''
class(base(4)), allocatable :: b1 ! tcx: (4)
type(base(4)) :: b2 ! tcx: (4)
type(base(4)), allocatable :: b3 ! tcx: (4)
character(11) :: internalFile (10) =''
namelist /nml/ b1, b2, b3
allocate(b1, b3)
b1%i = 2
b2%i = 6
b3%i = 8
write (internalFile, NML=nml, iostat=stat, iomsg=msg)
print*, stat
print*, msg
if ( stat /= 0 ) ERROR STOP 1
end program
subroutine writeformatted (dtv, unit, iotype, v_list, iostat, iomsg)
use m, only: base
class(base(4)), intent(in) :: dtv ! tcx: (4)
integer, intent(in) :: unit
character(*), intent(in) :: iotype
integer, intent(in) :: v_list(:)
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
write (unit, "(' i=',I2)", iostat=iostat ) dtv%i
end subroutine
Flang failed as:
> a.out
1002
Excessive output to fixed-size record
Fortran ERROR STOP: code 1
Both gfortran and XLF executes the program successfully.