[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison bug when standard input is closed
From: |
Hans Aberg |
Subject: |
Re: bison bug when standard input is closed |
Date: |
Sat, 01 Jan 2005 19:48:10 +0100 |
User-agent: |
Microsoft-Outlook-Express-Macintosh-Edition/5.0.6 |
On 2005/01/01 10:26, Paul Eggert at address@hidden wrote:
>> There is a bug in the scan-skel.l dating back to at least Bison 1.75: The
>> rule that opens the file streams, at the first run, it tries to close the
>> standard output stream.
>
> Thanks for reporting this. I installed the following patch. ...
> + if (outname)
> + {
> + free (outname);
> + xfclose (yyout);
> + }
> outname = xstrdup (filename);
> - xfclose (yyout);
> yyout = xfopen (outname, "w");
> lineno = 1;
> }
It seems to work with me. Strictly speaking, I think the operation of
closing an already closed file under C is undefined. So it is probably good
to fix this type of problem, because it is a kind of bug very hard to
detect, when it causes a problem.
There is the same rror in the last rule:
<<EOF>> xfclose (yyout); free (outname); return EOF;
This is an error of skeleton files that do not contain an @output.
So change to say
<<EOF>> if (outname) xfclose (yyout); free (outname); return EOF;
or
<<EOF>> if (outname) { xfclose (yyout); free (outname); } return EOF;
I am not sure why skeleton files without @output causes nontermination.
There must be an input pattern not matched by any of the rules.
Hans Aberg