mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
When a literal string is used to define two different tokens,
`bison -v' segfaults. Reported by Piotr Gackiewicz, and fixed by Neil Booth. * tests/regression.m4: New file. Include the core of the sample provided by Piotr Gackiewicz. * src/reader.c (parse_token_decl): Diagnose bad cases, and proceed properly.
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
# Distribute the testsuite since GNU M4 is needed to build it.
|
||||
noinst_SCRIPTS = testsuite
|
||||
|
||||
SUITE = calc.m4
|
||||
SUITE = calc.m4 regression.m4
|
||||
|
||||
EXTRA_DIST = atgeneral.m4 suite.m4 $(SUITE)
|
||||
|
||||
|
||||
26
tests/regression.m4
Normal file
26
tests/regression.m4
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- Autoconf -*-
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Regression tests.
|
||||
|
||||
EOF
|
||||
|
||||
AT_SETUP(Duplicate string)
|
||||
|
||||
AT_DATA([duplicate.y],
|
||||
[[/* `Bison -v' used to dump core when two tokens are defined with the same
|
||||
string, as LE and GE below. */
|
||||
|
||||
%token NUM
|
||||
%token LE "<="
|
||||
%token GE "<="
|
||||
|
||||
%%
|
||||
exp: '(' exp ')' | NUM ;
|
||||
%%
|
||||
]])
|
||||
|
||||
AT_CHECK([bison -v duplicate.y -o duplicate.c], 0, ignore, ignore)
|
||||
|
||||
AT_CLEANUP(duplicate.*)
|
||||
@@ -5,3 +5,4 @@
|
||||
AT_INIT([bison])
|
||||
|
||||
AT_INCLUDE([calc.m4])
|
||||
AT_INCLUDE([regression.m4])
|
||||
|
||||
Reference in New Issue
Block a user