mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-23 11:13:03 +00:00
cex: fix crash from zombie result
Fixes the SEGV in test 247 (counterexample.at:195): "S/R after first token". * src/counterexample.c: here. * tests/counterexample.at: Fix expectations.
This commit is contained in:
committed by
Akim Demaille
parent
93c849ef0d
commit
66283fb625
@@ -559,6 +559,13 @@ search_state_free (search_state *ss)
|
|||||||
free (ss);
|
free (ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
search_state_retain_derivs (search_state *ss)
|
||||||
|
{
|
||||||
|
parse_state_retain_deriv (ss->states[0]);
|
||||||
|
parse_state_retain_deriv (ss->states[1]);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
search_state_print (search_state *ss)
|
search_state_print (search_state *ss)
|
||||||
{
|
{
|
||||||
@@ -1057,12 +1064,11 @@ unifying_example (state_item_number itm1,
|
|||||||
// we've found a unifying counterexample.
|
// we've found a unifying counterexample.
|
||||||
cex = new_counterexample (d1, d2, true, false);
|
cex = new_counterexample (d1, d2, true, false);
|
||||||
// prevent d1/d2 from being freed.
|
// prevent d1/d2 from being freed.
|
||||||
parse_state_retain_deriv (ps1);
|
search_state_retain_derivs (ss);
|
||||||
parse_state_retain_deriv (ps2);
|
|
||||||
goto cex_search_end;
|
goto cex_search_end;
|
||||||
}
|
}
|
||||||
if (!stage3result)
|
if (!stage3result)
|
||||||
stage3result = ss;
|
stage3result = copy_search_state (ss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TIME_LIMIT_ENFORCED)
|
if (TIME_LIMIT_ENFORCED)
|
||||||
@@ -1094,7 +1100,11 @@ cex_search_end:;
|
|||||||
// If a search state from Stage 3 is available, use it
|
// If a search state from Stage 3 is available, use it
|
||||||
// to construct a more compact nonunifying counterexample.
|
// to construct a more compact nonunifying counterexample.
|
||||||
if (stage3result)
|
if (stage3result)
|
||||||
cex = complete_diverging_examples (stage3result, next_sym);
|
{
|
||||||
|
cex = complete_diverging_examples (stage3result, next_sym);
|
||||||
|
search_state_retain_derivs (stage3result);
|
||||||
|
search_state_free (stage3result);
|
||||||
|
}
|
||||||
// Otherwise, construct a nonunifying counterexample that
|
// Otherwise, construct a nonunifying counterexample that
|
||||||
// begins from the start state using the shortest
|
// begins from the start state using the shortest
|
||||||
// lookahead-sensitive path to the reduce item.
|
// lookahead-sensitive path to the reduce item.
|
||||||
|
|||||||
@@ -222,8 +222,8 @@ Shift-Reduce Conflict:
|
|||||||
10: 8 x: X .
|
10: 8 x: X .
|
||||||
10: 9 xx: X . X
|
10: 9 xx: X . X
|
||||||
On Symbol: X
|
On Symbol: X
|
||||||
First Example X • X
|
First Example X • X xy
|
||||||
First derivation t ::=[ x ::=[ X • ] X ]
|
First derivation a ::=[ x ::=[ X • ] t ::=[ X xy ] ]
|
||||||
Second Example A X • X
|
Second Example A X • X
|
||||||
Second derivation a ::=[ t ::=[ A xx ::=[ X • X ] ] ]
|
Second derivation a ::=[ t ::=[ A xx ::=[ X • X ] ] ]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user