bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: segmentation fault when reading a directive with a sintax error


From: Paul Eggert
Subject: Re: segmentation fault when reading a directive with a sintax error
Date: Sun, 24 Jul 2005 20:40:52 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Pablo De Napoli <address@hidden> writes:

> I want to report a problem with bison (though you might be aware of it)

>  %pure-parser
> %parse-param a

Thanks for reporting that; I didn't know about the problem.
I installed this patch:

2005-07-24  Paul Eggert  <address@hidden>

        Fix core dump reported by Pablo De Napoli in
        <http://lists.gnu.org/archive/html/bug-bison/2005-07/msg00053.html>.
        * tests/regression.at (Invalid inputs with {}): New test.
        * src/parse-gram.y (token_name): Translate type before using
        it as an index.

Index: src/parse-gram.y
===================================================================
RCS file: /cvsroot/bison/bison/src/parse-gram.y,v
retrieving revision 1.56
diff -p -u -r1.56 parse-gram.y
--- src/parse-gram.y    24 Jul 2005 07:24:22 -0000      1.56
+++ src/parse-gram.y    25 Jul 2005 03:33:28 -0000
@@ -538,5 +538,5 @@ gram_error (location const *loc, char co
 char const *
 token_name (int type)
 {
-  return yytname[type];
+  return yytname[YYTRANSLATE (type)];
 }
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.92
diff -p -u -r1.92 regression.at
--- tests/regression.at 21 Jul 2005 20:53:03 -0000      1.92
+++ tests/regression.at 25 Jul 2005 03:33:28 -0000
@@ -303,6 +303,27 @@ input.y:7.1-8.0: missing `%}' at end of 
 AT_CLEANUP
 
 
+AT_SETUP([Invalid inputs with {}])
+
+AT_DATA([input.y],
+[[
+%destructor
+%initial-action
+%lex-param
+%parse-param
+%printer
+%union
+]])
+
+AT_CHECK([bison input.y], [1], [],
+[[input.y:3.1: missing `{' in "%destructor {...}"
+input.y:4.1: missing `{' in "%initial-action {...}"
+input.y:4.1: syntax error, unexpected %initial-action {...}, expecting string 
or identifier
+]])
+
+AT_CLEANUP
+
+
 
 ## ------------------- ##
 ## Token definitions.  ##




reply via email to

[Prev in Thread] Current Thread [Next in Thread]