[patch, libgfortran] PR31052 Bad IOSTAT values when readings NAMELISTs past EOF

Brooks Moses brooks.moses@codesourcery.com
Sat Mar 10 12:50:00 GMT 2007

Jerry DeLisle wrote:
> Steve Kargl wrote:
>> I haven't read the PR nor your patch.  But, if
>> someone is trying to rewind /dev/null, he/she
>> is an idiot.  If it was me, I'd close the PR
>> with a rather biting comment about stupidity.
> Easy guy, its the existing dev_null.f90 in gfortran.dg thats doing this rewind. 
>   If you suggest we get rid of the rewind in there, then patching this PR is 
> simply delete the call to test_endfile in st_rewind.

I suspect /dev/null there is acting as a proxy for other sources that 
also can't be rewound, but can't be easily tested in a testcase.

I've certainly written codes that did rewinds which weren't obviously 
necessary from the end-user standpoint, and I could certainly imagine an 
unknowing user (or a forgetful user, if the user was me) hooking them up 
to some source -- a named pipe, say -- which didn't support rewinding. 
I'd be a bit annoyed if GFortran didn't handle that with a reasonable 
error/IOSTAT result.

Thus, if you remove this from dev_null.f90, I'd want to recommend 
checking to make sure that you're _only_ breaking /dev/null and not 
breaking other non-rewindable sources, and ideally make sure that this 
is still tested some other way in the testsuite.

- Brooks

More information about the Gcc-patches mailing list