[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: Both: Gr. Reduction
From: |
Akim Demaille |
Subject: |
FYI: Both: Gr. Reduction |
Date: |
28 Nov 2001 12:42:18 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
It looks like I broke something recently :*(. 1.30 dies, including
with the patch below, when producing the verbose report (while reading
tags[-1]). Also, be frightened, be very frightened:
| ~/src/bison-1.29 % cd tests/testsuite.dir/17
| tests/testsuite.dir/17 % cat input.y
| %verbose
| %output="input.c"
|
| %nterm useless1
| %nterm useless2
| %nterm useless3
| %nterm useless4
| %nterm useless5
| %nterm useless6
| %nterm useless7
| %nterm useless8
| %nterm useless9
|
| %token useful
| %%
| exp: useful;
| tests/testsuite.dir/17 % cat input.output
| Useless nonterminals:
|
| exp
|
|
|
Ahem...
Index: ChangeLog
from Akim Demaille <address@hidden>
* tests/reduce.at (Useless Terminals, Useless Nonterminals): New.
* src/reduce.c (reduce_grammar_tables): Do not free useless tags,
as all tags are free'ed afterwards.
From Enrico Scholz.
Index: THANKS
===================================================================
RCS file: /cvsroot/bison/bison/THANKS,v
retrieving revision 1.10.2.13
diff -u -u -r1.10.2.13 THANKS
--- THANKS 2001/11/26 19:19:21 1.10.2.13
+++ THANKS 2001/11/28 11:33:21
@@ -8,6 +8,7 @@
Daniel Hagerty address@hidden
David J. MacKenzie address@hidden
Dick Streefland address@hidden
+Enrico Scholz address@hidden
Fabrice Bauzac address@hidden
Hans Aberg address@hidden
Jesse Thilo address@hidden
Index: src/reduce.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reduce.c,v
retrieving revision 1.19.2.7
diff -u -u -r1.19.2.7 reduce.c
--- src/reduce.c 2001/11/19 09:21:26 1.19.2.7
+++ src/reduce.c 2001/11/28 11:33:21
@@ -352,10 +352,6 @@
sprec[n] = sprec[i];
tags[n] = tags[i];
}
- else
- {
- free (tags[i]);
- }
}
/* Replace all symbol numbers in valid data structures. */
Index: tests/Makefile.am
===================================================================
RCS file: /cvsroot/bison/bison/tests/Makefile.am,v
retrieving revision 1.5.2.10
diff -u -u -r1.5.2.10 Makefile.am
--- tests/Makefile.am 2001/11/12 09:14:50 1.5.2.10
+++ tests/Makefile.am 2001/11/28 11:33:21
@@ -25,7 +25,7 @@
TESTSUITE_AT = \
testsuite.at \
- output.at calc.at torture.at regression.at
+ output.at reduce.at calc.at torture.at regression.at
TESTSUITE = $(srcdir)/testsuite
AUTOTEST = $(AUTOM4TE) --language=autotest
Index: tests/Makefile.in
===================================================================
RCS file: /cvsroot/bison/bison/tests/Attic/Makefile.in,v
retrieving revision 1.3.2.16
diff -u -u -r1.3.2.16 Makefile.in
--- tests/Makefile.in 2001/11/12 09:19:48 1.3.2.16
+++ tests/Makefile.in 2001/11/28 11:33:21
@@ -108,7 +108,7 @@
TESTSUITE_AT = \
testsuite.at \
- output.at calc.at torture.at regression.at
+ output.at reduce.at calc.at torture.at regression.at
TESTSUITE = $(srcdir)/testsuite
Index: tests/reduce.at
===================================================================
RCS file: reduce.at
diff -N reduce.at
--- /dev/null Sat Apr 14 20:46:23 2001
+++ tests/reduce.at Wed Nov 28 06:33:21 2001
@@ -0,0 +1,106 @@
+# Exercising Bison Grammar Reduction. -*- Autotest -*-
+# Copyright 2001 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AT_BANNER([[Grammar Reduction.]])
+
+
+## ------------------- ##
+## Useless Terminals. ##
+## ------------------- ##
+
+AT_SETUP([Useless Terminals])
+
+AT_DATA([[input.y]],
+[[%verbose
+%output="input.c"
+
+%token useless1
+%token useless2
+%token useless3
+%token useless4
+%token useless5
+%token useless6
+%token useless7
+%token useless8
+%token useless9
+
+%token useful
+%%
+exp: useful;
+]])
+
+AT_CHECK([[bison input.y]])
+
+AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
+[[Terminals which are not used:
+ useless1
+ useless2
+ useless3
+ useless4
+ useless5
+ useless6
+ useless7
+ useless8
+ useless9
+]])
+
+AT_CLEANUP
+
+
+
+## ---------------------- ##
+## Useless Nonterminals. ##
+## ---------------------- ##
+
+AT_SETUP([Useless Nonterminals])
+
+AT_DATA([[input.y]],
+[[%verbose
+%output="input.c"
+
+%nterm useless1
+%nterm useless2
+%nterm useless3
+%nterm useless4
+%nterm useless5
+%nterm useless6
+%nterm useless7
+%nterm useless8
+%nterm useless9
+
+%token useful
+%%
+exp: useful;
+]])
+
+AT_CHECK([[bison input.y]])
+
+AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
+[[Terminals which are not used:
+ useless1
+ useless2
+ useless3
+ useless4
+ useless5
+ useless6
+ useless7
+ useless8
+ useless9
+]])
+
+AT_CLEANUP
Index: tests/testsuite.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/testsuite.at,v
retrieving revision 1.1.2.5
diff -u -u -r1.1.2.5 testsuite.at
--- tests/testsuite.at 2001/11/14 15:16:40 1.1.2.5
+++ tests/testsuite.at 2001/11/28 11:33:21
@@ -26,6 +26,7 @@
AT_TESTED([bison])
m4_include([output.at])
+m4_include([reduce.at])
m4_include([calc.at])
m4_include([torture.at])
m4_include([regression.at])
- FYI: Both: Gr. Reduction,
Akim Demaille <=