I wrote:
Peter N Lewis wrote:
gpc crashes compiling the following (erroneous) program. It correctly detects the syntax error, and then crashes with the crash report following.
program peterW;
function Doit( Integer(info): Integer ): Integer; begin end;
begin end.
Seems to be a Bison bug (uninitialized usage of yystack->yyerror_range[1]). I will investigate further and report to the Bison maintainers. Thanks for the report.
By a rather strange coincidence, one of the Bison maintainers, Paul Hilfinger, found the same bug just the next day, before I got around to writing a bug report. The patch he sent fixes your problem.
Attached is a patch to the generated parse.c file of GPC, and Paul Hilfinger's Bison patch (re-diffed by me for Bison 2.0). You'll need the latter if you ever build GPC from a minimal distribution or ever modify parse.y or apply a patch that does so. You do not have to rebuild Bison, you can apply the patch to the glr.c file installed in /usr/[local/]share/bison/ or wherever. If you want to build Bison yourself, apply the patch in <bison-source>/data/ before building.
Frank