* data/glr.c (yyresolveLocations): Remove bogus YYASSERT that the

state before an empty RHS is always resolved here.  Only the location
of that state is guaranteed to be resolved, and that's enough.  This
fixes the remaining bug reported by Derek M. Jones in
<http://lists.gnu.org/archive/html/bug-bison/2006-05/msg00027.html>.
* tests/glr-regression.at (Uninitialized location when reporting
ambiguity): Test the above case.
Also, the embedded comments in this test case claim it checks the case
of an empty RHS that has inherited the initial location.  However, the
corresponding LHS was already resolved, so yyresolveLocations didn't
actually have reason to modify it.  Fix this by forcing
nondeterministic operation at the beginning of the parse.
This commit is contained in:
Joel E. Denny
2006-05-21 06:22:36 +00:00
parent 50cce58e9a
commit 5ad0a449d6
3 changed files with 35 additions and 9 deletions

View File

@@ -201,7 +201,7 @@ typedef struct YYLTYPE
]])
b4_defines_if([#include @output_header_name@],
[b4_shared_declarations])[
[b4_shared_declarations])[
/* Enabling traces. */
#ifndef YYDEBUG
@@ -1836,8 +1836,14 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
}
else
{
/* Both yyresolveAction and yyresolveLocations traverse the GSS
in reverse rightmost order. It is only necessary to invoke
yyresolveLocations on a subforest for which yyresolveAction
would have been invoked next had an ambiguity not been
detected. Thus the location of the previous state (but not
necessarily the previous state itself) is guaranteed to be
resolved already. */
yyGLRState *yyprevious = yyoption->yystate;
YYASSERT (yyprevious->yyresolved);
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
}
yychar_current = yychar;