(set_conflicts): Resolve all conflicts, not just

the first one.  This change is from Paul Hilfinger, and it fixes
regression reported by Werner Lemberg in
<http://mail.gnu.org/archive/html/bug-bison/2003-04/msg00026.html>.

(resolve_sr_conflict): Don't invoke state_errs_set
unless one or more tokens have been explicitly made errors.
Otherwise, the above change causes Bison to abort.
This commit is contained in:
Paul Eggert
2003-04-18 05:07:08 +00:00
parent b8be913233
commit 0de45ae542

View File

@@ -237,9 +237,12 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
}
}
/* Some tokens have been explicitly made errors. Allocate a
permanent errs structure for this state, to record them. */
state_errs_set (s, nerrs, errors);
if (nerrs)
{
/* Some tokens have been explicitly made errors. Allocate a
permanent errs structure for this state, to record them. */
state_errs_set (s, nerrs, errors);
}
if (obstack_object_size (&solved_conflicts_obstack))
{
@@ -277,10 +280,7 @@ set_conflicts (state *s, symbol **errors)
for (i = 0; i < reds->num; ++i)
if (reds->rules[i]->prec && reds->rules[i]->prec->prec
&& !bitset_disjoint_p (reds->lookaheads[i], lookaheadset))
{
resolve_sr_conflict (s, i, errors);
break;
}
resolve_sr_conflict (s, i, errors);
/* Loop over all rules which require lookahead in this state. Check
for conflicts not resolved above. */