[buddy] Remove some valgrind warnings about uninitialized memory when

BddCache_lookup return an entry from a Not operation.

* src/bddop.c (apply_rec, simplify_rec): When checking the cache
entry, always check entry->a and entry->c before checking
entry->b, because the "not_rec()" function does not initialize
the latter.
This commit is contained in:
Alexandre Duret-Lutz 2011-06-09 11:56:02 +02:00
parent a0ca684dc6
commit d3ccaa7cb9
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,13 @@
2011-06-09 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Remove some valgrind warnings about uninitialized memory when
BddCache_lookup return an entry from a Not operation.
* src/bddop.c (apply_rec, simplify_rec): When checking the cache
entry, always check entry->a and entry->c before checking
entry->b, because the "not_rec()" function does not initialize
the latter.
2011-06-07 Alexandre Duret-Lutz <adl@lrde.epita.fr> 2011-06-07 Alexandre Duret-Lutz <adl@lrde.epita.fr>
* examples/cmilner/cmilner.c (A, transitions, initial_state) * examples/cmilner/cmilner.c (A, transitions, initial_state)

View file

@ -619,7 +619,8 @@ static BDD apply_rec(BDD l, BDD r)
{ {
entry = BddCache_lookup(&applycache, APPLYHASH(l,r,applyop)); entry = BddCache_lookup(&applycache, APPLYHASH(l,r,applyop));
if (entry->a == l && entry->b == r && entry->c == applyop) // Check entry->c last, because not_rec() does not initialize it.
if (entry->a == l && entry->c == applyop && entry->b == r)
{ {
#ifdef CACHESTATS #ifdef CACHESTATS
bddcachestats.opHit++; bddcachestats.opHit++;
@ -1649,7 +1650,8 @@ static BDD simplify_rec(BDD f, BDD d)
entry = BddCache_lookup(&applycache, APPLYHASH(f,d,bddop_simplify)); entry = BddCache_lookup(&applycache, APPLYHASH(f,d,bddop_simplify));
if (entry->a == f && entry->b == d && entry->c == bddop_simplify) // Check entry->c last, because not_rec() does not initialize it.
if (entry->a == f && entry->c == bddop_simplify && entry->b == d)
{ {
#ifdef CACHESTATS #ifdef CACHESTATS
bddcachestats.opHit++; bddcachestats.opHit++;