[buddy] Fix a harmless uninitialized read.

This can only cause failure when running under valgrind (i.e., in the
test suite), but is not a problem in practice as the test is certain
to fail the entry->c check whenever entry->b is uninitialized.

* src/bddop.c (bdd_implies): Here.
This commit is contained in:
Alexandre Duret-Lutz 2014-08-11 00:18:54 +02:00
parent 55715dfb87
commit 1244b61710

View file

@ -917,7 +917,8 @@ int bdd_implies(BDD l, BDD r)
return 0;
entry = BddCache_lookup(&misccache, IMPLIESHASH(l,r));
if (entry->a == l && entry->b == r && entry->c == CACHEID_IMPLIES)
// Check entry->b last, because not_rec() does not initialize it.
if (entry->a == l && entry->c == CACHEID_IMPLIES && entry->b == r)
{
#ifdef CACHESTATS
bddcachestats.opHit++;
@ -1758,7 +1759,7 @@ static BDD simplify_rec(BDD f, BDD d)
entry = BddCache_lookup(&applycache, APPLYHASH(f,d,bddop_simplify));
// Check entry->c last, because not_rec() does not initialize it.
// Check entry->b last, because not_rec() does not initialize it.
if (entry->a == f && entry->c == bddop_simplify && entry->b == d)
{
#ifdef CACHESTATS