Namelist read from stdin
Harald Anlauf
anlauf@gmx.de
Wed Jan 9 21:20:00 GMT 2019
Hi Steve, all,
On 01/08/19 23:50, Steve Kargl wrote:
> On Tue, Jan 08, 2019 at 11:14:50PM +0100, Harald Anlauf wrote:
>>
>> namelist read from stdin (unit 5) mostly works as from file,
>> but I've found a case where the reading seems to get confused
>> during error recovery. This may lead to skipped (lost) namelists.
>>
>
> What do you mean by error recovery?
I think there is some special behavior inside libgfortran
when it tries to recover from an invalid namelist read.
This happens only when the unit number is 5.
I submitted a testcase here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88776
>> This seems clearly restricted to unit 5, and requires that a
>> badly formatted namelist is encountered, otherwise it is fine.
>>
>> Is this due to lack of or issues with buffering of STDIN?
>> GFORTRAN_UNBUFFERED_PRECONNECTED=y/n does not seem to have any
>> influence.
>>
>> Is there something trivial I've overlooked? Otherwise I'll prepare
>> a PR.
>
> AFAIK, stdin is not seekable. If the error recovery you
> mention requires rewinding to an earlier place in the
> file stream, you're done.
In the testcase above there is no rewinding in the user code.
If that happens, it would be the library.
(The full code tries to catch invalid namelists and rewinds,
but gives fun with some other compilers. :)
Harald
More information about the Fortran
mailing list