Gfortran and ifort both run this program but give different outputs when list-directed reading a real value into an integer variable. Is the program f2018-compliant? Are both compilers f2018-compliant?
program listdirected
implicit none
integer:: i = 42, ios
character:: input*7 = '3.14159', msg*200
read(input,*,iostat=ios,iomsg=msg) i
if(ios /= 0) print*, trim(msg)
print*, 'i = ',i
end program listdirected
Both compilers are compliant. The standard says, “When the next effective item is of type integer, the value in the input record is interpreted as if an Iw edit descriptor with a suitable value of w were used.” What is “suitable” is implementation-dependent. Intel Fortran is more forgiving than the standard in that it allows free conversion among numeric types in list-directed input. The standard does not require a processor to diagnose this.