[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison 1.50: SunOS 4.1.4, Problems and Hack for lib/timevar.c
From: |
Paul Eggert |
Subject: |
Re: Bison 1.50: SunOS 4.1.4, Problems and Hack for lib/timevar.c |
Date: |
Fri, 18 Oct 2002 18:38:49 -0700 (PDT) |
> Date: Tue, 15 Oct 2002 22:41:32 +0200
> From: Peter Klein <address@hidden>
>
> 67. calc.at:487: testing Calculator %glr_parser %error-verbose...
> calc.at:487: bison -o calc.c calc.y
> calc.at:487: $CC $CFLAGS $CPPFLAGS calc.c -o calc
> stderr:
> calc.c: In function `yyreportParseError':
> calc.c:1597: invalid operands to binary +
> calc.c:1604: invalid operands to binary +
> calc.at:487: exit code was 1, expected 0
> 67. calc.at:487: FAILED near `calc.at:487'
Thanks for that bug report. I installed the following patch for this
problem, and it should appear in Bison 1.875 whenever it comes out.
2002-10-18 Paul Eggert <address@hidden>
* data/glr.c (yyreportParseError): Don't assume that sprintf
yields the length of the printed string, as this is not true
on SunOS 4.1.4. Reported by Peter Klein.
Index: glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -p -u -r1.16 -r1.17
--- glr.c 14 Oct 2002 13:00:48 -0000 1.16
+++ glr.c 19 Oct 2002 01:33:20 -0000 1.17
@@ -1552,15 +1552,17 @@ yyreportParseError (yyGLRStack* yystack,
yysize += strlen (yytokenName (yyx)) + strlen (yyprefix),
yycount += 1, yyprefix = " or ";
yymsg = yyp = (char*) malloc (yysize);
- yyp += sprintf (yyp, "parse error, unexpected %s",
- yytokenName (*yytokenp));
+ sprintf (yyp, "parse error, unexpected %s",
+ yytokenName (*yytokenp));
+ yyp += strlen (yyp);
if (yycount < 5)
{
yyprefix = ", expecting ";
for (yyx = yyn < 0 ? -yyn : 0; yyx < yytname_size; yyx += 1)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
- yyp += sprintf (yyp, "%s%s", yyprefix, yytokenName (yyx));
+ sprintf (yyp, "%s%s", yyprefix, yytokenName (yyx));
+ yyp += strlen (yyp);
yyprefix = " or ";
}
}