Is this the expected behavior?
program test
character(len=256) :: line
integer :: num, error
line = "testing"
num = 5
write(6,*) trim(line),num
read(line,*,iostat=error) num
write(6,*) error, num
end program
When I compile it with pgfortran 17.1-0 or 17.4-0 and run it, I get:
testing 5
0 -1
which is OK for the first line, but the second? Why change the name of a variable that should not have been read, and why not signal an error that should have happened?
With gfortran 4.8.4 I get something more reasonable:
testing 5
5010 5
an unmodified variable and a non-zero error code.