cex: avoid uninitialized variables

* src/counterexample.c (item_rule_bounds): Split into...
(item_rule_start, item_rule_end): these.
Adjust dependencies.
* src/conflicts.c (find_state_item_number): New.
Use it to avoid uninitialized variables.
This commit is contained in:
Akim Demaille
2020-05-16 10:27:32 +02:00
parent da5317cc9d
commit 16f2353723
2 changed files with 41 additions and 39 deletions

View File

@@ -625,6 +625,15 @@ conflicts_total_count (void)
return count_sr_conflicts () + count_rr_conflicts ();
}
static state_item_number
find_state_item_number (const rule *r, state_number sn)
{
for (int i = state_item_map[sn]; i < state_item_map[sn + 1]; ++i)
if (item_number_as_rule_number (*state_items[i].item) == r->number)
return i;
abort ();
}
static void
report_state_counterexamples (const state *s)
{
@@ -633,19 +642,8 @@ report_state_counterexamples (const state *s)
for (int i = 0; i < reds->num; ++i)
{
rule *r1 = reds->rules[i];
state_item_number c1;
for (int j = state_item_map[sn];
j < state_item_map[sn + 1]; ++j)
{
if (item_number_as_rule_number (*state_items[j].item) == r1->number)
{
c1 = j;
break;
}
}
for (int j = state_item_map[sn];
j < state_item_map[sn + 1]; ++j)
const state_item_number c1 = find_state_item_number (r1, sn);
for (int j = state_item_map[sn]; j < state_item_map[sn + 1]; ++j)
{
if (SI_DISABLED (j))
continue;