Let nondeterministic skeletons be usable with deterministic

tables.
With the patch, GAWK compiled by GCC without -O2 passes its test
suite using a GLR parser driven by LALR tables.  It fails with -O2
because `struct stat' gives two different answers on my machine:
88 (definition of an auto var) and later 96 (memset on this var).
Hence the stack is badly corrumpted.  The headers inclusion is to
blame: if I move the awk.h inclusion before GLR's system header
inclusion, the two struct stat have the same size.
* src/tables.c (pack_table): Always create conflict_table.
(token_actions): Always create conflict_list.
* data/glr.c (YYFLAG): Remove, unused.
This commit is contained in:
Akim Demaille
2002-10-13 18:50:40 +00:00
parent f377f69fec
commit ea99527d23
4 changed files with 44 additions and 35 deletions

View File

@@ -220,7 +220,6 @@ static YYLTYPE yyloc_default;
/* YYFINAL -- State number of the termination state. */
#define YYFINAL ]b4_final_state_number[
#define YYFLAG ]b4_flag[
#define YYLAST ]b4_last[
/* YYNTOKENS -- Number of terminals. */
@@ -341,17 +340,17 @@ static const ]b4_int_type_for([b4_table])[ yytable[] =
]b4_table[
};
/* YYCONFLP[YYPACT[STATE-NUM]] -- pointer into yyconfl of start of list
of conflicting reductions corresponding to action entry for state
STATE-NUM in yytable. 0 means no conflicts. The list in yyconfl
is terminated by a rule number of 0. */
/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
list of conflicting reductions corresponding to action entry for
state STATE-NUM in yytable. 0 means no conflicts. The list in
yyconfl is terminated by a rule number of 0. */
static const ]b4_int_type_for([b4_conflict_list_heads])[ yyconflp[] =
{
]b4_conflict_list_heads[
};
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated
by 0, pointed into by YYCONFLP. */
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
0, pointed into by YYCONFLP. */
]dnl Do not use b4_int_type_for here, since there are places where
dnl pointers onto yyconfl are taken, which type is "short *".
dnl We probably ought to introduce a type for confl.
@@ -1591,7 +1590,7 @@ yyrecoverParseError (yyGLRStack* yystack, YYSTYPE* yylvalp, YYLTYPE* yyllocp)
/* Something's not right; we shouldn't be here. */
yyFail (yystack, NULL);
yyj += *yytokenp;
if (yyj < 0 || yyj > YYLAST || yycheck[yyj] != *yytokenp)
if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != *yytokenp)
{
if (yydefact[yystack->yytops.yystates[0]->yylrState] != 0)
return;