(set_conflicts): Resolve all conflicts, not just
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Apr 2003 05:07:08 +0000 (05:07 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Apr 2003 05:07:08 +0000 (05:07 +0000)
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.

src/conflicts.c

index 21ea7ce..fe1f6f9 100644 (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.  */