From: Angelo Borsotti Date: Mon, 7 Mar 2011 03:19:18 +0000 (-0500) Subject: java: fix parser stack popping bug. X-Git-Tag: v2.7.90~615 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/3f8ffd15eea8c3da460f8d40c80dd02cb1204a5a java: fix parser stack popping bug. Reported at . * THANKS (Angelo Borsotti): Add. * data/lalr1.java (YYParser::YYStack::pop): Fix off-by-one error in clearing the value stack. Previously, the top element of the stack wasn't cleared and so the value was not garbage collected. (cherry picked from commit 6f75992be50b83a084f955f63e5c35ccc8705f08) Conflicts: data/lalr1.java --- diff --git a/ChangeLog b/ChangeLog index 5c25fa28..b722256c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-03-06 Angelo Borsotti (tiny change) + + java: fix parser stack popping bug. + Reported at + . + * THANKS (Angelo Borsotti): Add. + * data/lalr1.java (YYParser::YYStack::pop): Fix off-by-one error + in clearing the value stack. Previously, the top element of the + stack wasn't cleared and so the value was not garbage collected. + 2011-03-06 Joel E. Denny doc: cite publication for LAC. diff --git a/THANKS b/THANKS index e13924aa..02082c1c 100644 --- a/THANKS +++ b/THANKS @@ -8,6 +8,7 @@ Alexander Belopolsky alexb@rentec.com Alexandre Duret-Lutz adl@src.lip6.fr Andreas Schwab schwab@suse.de Andrew Suffield asuffield@users.sourceforge.net +Angelo Borsotti angelo.borsotti@gmail.com Anthony Heading ajrh@ajrh.net Arnold Robbins arnold@skeeve.com Art Haas ahaas@neosoft.com diff --git a/data/lalr1.java b/data/lalr1.java index 309fc956..e1b488c4 100644 --- a/data/lalr1.java +++ b/data/lalr1.java @@ -303,7 +303,7 @@ b4_lexer_if([[ public final void pop (int num) { // Avoid memory leaks... garbage collection is a white lie! if (num > 0) { - java.util.Arrays.fill (valueStack, height - num + 1, height, null); + java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null); ]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height, null);]])[ } height -= num;