This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Brooks Moses wrote:
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


I would rather keep the patch as I have it and leave dev_null.f90 alone. In this case we are user proofing. st_rewind is simply seeking to position zero of the file and then resetting all the internal libgfortran accounting stuff. /dev/null is a "special seekable" file.

I have also tested this on an empty file and it works OK for that. The adjustment in the patch occurs well after all the rewind stuff is done.

I will await approval.

Thanks,

Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]