The following program does formatted writes of an integer to an internal file (i.e., a buffer) with three different variations. The second WRITE writes using a field width of 4, which is adequate for the integer 123, but the resulting string is longer than the record length of the internal file, which is 3.
I think that the second WRITE should yield a positive IOSTAT value, a suitable IOMSG, and leave the record unchanged. Absoft Fortran returns IOSTAT = 0, instead, and the written record is incorrect.
program asterisks
character(3) str
character(100) msg
n=123
print *,'Str Iostat Message'
str='xyz'; msg=' - '; write(str,'(i0)',iostat=i,iomsg=msg) n
write(*,10) str,i,trim(msg)
str='xyz'; msg=' - '; write(str,'(i4)',iostat=i,iomsg=msg) n
write(*,10) str,i,trim(msg)
str='xyz'; msg=' - '; write(str,'(i2)',iostat=i,iomsg=msg) n
write(*,10) str,i,trim(msg)
10 format(1x,A3,i5,4x,A)
end
Intel Fortran gives:
Str Iostat Message
123 0 -
66 output statement overflows record, unit -5, file Internal Formatted Write
** 0