[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug bison 1.31
From: |
Akim Demaille |
Subject: |
Re: bug bison 1.31 |
Date: |
22 Jan 2002 11:34:11 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) |
| hello,
|
| le programme suivant genere un segfault avec bison-1.31 :
|
| --- [test3.y]
| %%
| %{
| #include <stdio.h>
| }%
|
| %%
| A : {printf("hallo\n");}
| --- [end test3.y]
|
| $ bison test3.y
| Segmentation fault
| $
|
| [Reference : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=129483 ]
Thanks for the report. I'm applying this:
Index: ChangeLog
from Akim Demaille <address@hidden>
Bison dumps core when trying to complain about broken input files.
Reported by Cris van Pelt.
* src/lex.c (parse_percent_token): Be sure to set token_buffer.
* tests/regression.at (Invalid input: 1, Invalid input: 2): Merge
into...
(Invalid inputs): Strengthen: exercise parse_percent_token.
Index: THANKS
===================================================================
RCS file: /cvsroot/bison/bison/THANKS,v
retrieving revision 1.10.2.23
diff -u -u -r1.10.2.23 THANKS
--- THANKS 21 Jan 2002 15:48:25 -0000 1.10.2.23
+++ THANKS 22 Jan 2002 10:29:01 -0000
@@ -6,6 +6,7 @@
Albert Chin-A-Young address@hidden
Alexander Belopolsky address@hidden
Arnold Robbins address@hidden
+Cris van Pelt address@hidden
Daniel Hagerty address@hidden
David J. MacKenzie address@hidden
Dick Streefland address@hidden
Index: src/lex.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.c,v
retrieving revision 1.33.2.12
diff -u -u -r1.33.2.12 lex.c
--- src/lex.c 14 Nov 2001 14:42:14 -0000 1.33.2.12
+++ src/lex.c 22 Jan 2002 10:29:02 -0000
@@ -590,43 +590,54 @@
size_t arg_offset = 0;
int c = getc (finput);
+ obstack_1grow (&token_obstack, '%');
+ obstack_1grow (&token_obstack, c);
switch (c)
{
case '%':
+ token_buffer = obstack_finish (&token_obstack);
return tok_two_percents;
case '{':
+ token_buffer = obstack_finish (&token_obstack);
return tok_percent_left_curly;
- /* FIXME: Who the heck are those 5 guys!?! `%<' = `%left'!!!
- Let's ask for there removal. */
+ /* The following guys are here for backward compatibility with
+ very ancient Yacc versions. The paper of Johnson mentions
+ them (as ancient :). */
case '<':
+ token_buffer = obstack_finish (&token_obstack);
return tok_left;
case '>':
+ token_buffer = obstack_finish (&token_obstack);
return tok_right;
case '2':
+ token_buffer = obstack_finish (&token_obstack);
return tok_nonassoc;
case '0':
+ token_buffer = obstack_finish (&token_obstack);
return tok_token;
case '=':
+ token_buffer = obstack_finish (&token_obstack);
return tok_prec;
}
if (!isalpha (c))
- return tok_illegal;
+ {
+ token_buffer = obstack_finish (&token_obstack);
+ return tok_illegal;
+ }
- obstack_1grow (&token_obstack, '%');
- while (isalpha (c) || c == '_' || c == '-')
+ while (c = getc (finput), isalpha (c) || c == '_' || c == '-')
{
if (c == '_')
c = '-';
obstack_1grow (&token_obstack, c);
- c = getc (finput);
}
/* %DIRECTIVE="ARG". Separate into
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.1.2.26
diff -u -u -r1.1.2.26 regression.at
--- tests/regression.at 14 Jan 2002 10:16:49 -0000 1.1.2.26
+++ tests/regression.at 22 Jan 2002 10:29:02 -0000
@@ -545,40 +545,30 @@
AT_CLEANUP
-## ----------------- ##
-## Invalid input 1. ##
-## ----------------- ##
+## ---------------- ##
+## Invalid inputs. ##
+## ---------------- ##
-AT_SETUP([Invalid input: 1])
+AT_SETUP([Invalid inputs])
AT_DATA([input.y],
[[%%
?
-]])
-
-AT_CHECK([bison input.y], [1], [],
-[[input.y:2: invalid input: `?'
-input.y:3: fatal error: no rules in the input grammar
-]])
-
-AT_CLEANUP
-
-
-## ----------------- ##
-## Invalid input 2. ##
-## ----------------- ##
-
-
-AT_SETUP([Invalid input: 2])
-
-AT_DATA([input.y],
-[[%%
default: 'a' }
+%{
+%&
+%a
+%-
]])
AT_CHECK([bison input.y], [1], [],
-[[input.y:2: invalid input: `}'
+[[input.y:2: invalid input: `?'
+input.y:3: invalid input: `}'
+input.y:4: invalid input: `%{'
+input.y:5: invalid input: `%&'
+input.y:6: invalid input: `%a'
+input.y:7: invalid input: `%-'
]])
AT_CLEANUP
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: bug bison 1.31,
Akim Demaille <=