larsa@nada.kth.se (Lars Andersson) (01/29/90)
I found what appears to be a bug in SUN f77 (version 1.1 under SUN OS 4.0.3). The problem appears to be caused by not flushing the input buffer after a read error condition has been detected. The problem is reproduced by the following piece of code: PROGRAM TTT INTEGER A 100 CONTINUE #ifndef NOFLUSH CALL FLUSH(5) #endif NOFLUSH WRITE(6 ,'(A$)')'TESTING' READ(5 ,*,ERR=100,END=998)A write(*,*)'ANSWER = ',A GOTO 1000 998 CONTINUE WRITE(*,*)'END OF FILE FOUND' 1000 CONTINUE END saving this in a file ttt.F and compiling with f77 -o ttt ttt.F produces an executable which has the correct behaviour, namely inputting a character instead of an integer causes the prompt to appear and processing continues. On the other hand compiling with f77 -DNOFLUSH -o ttt ttt.F and entering a character causes an infinite loop (be warned, this is how I discovered the problem.....). As I understand it, the correct behaviour is to flush the input buffer and this is what appears to happen with the old SUN f77 (under 3.5). If there exists a patch which cures this behaviour, I would like to be informed of it. On a different note: one feature which I sorely miss (or have been unable to find) in the SUN f77 is the possibility to set, at compiletime, "floating point indefinite" as initial value for variables. This is quite effective in finding bugs in your code and is possible on some machines that I know of. Any comments? Lars Andersson larsa@nada.kth.se