Skip to content

Commit b1c73c1

Browse files
committed
Fixing a valgrind warning.
1 parent 5ade9e9 commit b1c73c1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/aig/gia/giaTsim.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ Gia_ManTer_t * Gia_ManTerCreate( Gia_Man_t * pAig )
8484
p = ABC_CALLOC( Gia_ManTer_t, 1 );
8585
p->pAig = Gia_ManFront( pAig );
8686
p->nIters = 300;
87-
p->pDataSim = ABC_ALLOC( unsigned, Abc_BitWordNum(2*p->pAig->nFront) );
88-
p->pDataSimCis = ABC_ALLOC( unsigned, Abc_BitWordNum(2*Gia_ManCiNum(p->pAig)) );
89-
p->pDataSimCos = ABC_ALLOC( unsigned, Abc_BitWordNum(2*Gia_ManCoNum(p->pAig)) );
87+
// these buffers are accessed through XOR-based setters that read the current word first,
88+
// so they must be zero-initialized to avoid touching undefined data on the first update
89+
p->pDataSim = ABC_CALLOC( unsigned, Abc_BitWordNum(2*p->pAig->nFront) );
90+
p->pDataSimCis = ABC_CALLOC( unsigned, Abc_BitWordNum(2*Gia_ManCiNum(p->pAig)) );
91+
p->pDataSimCos = ABC_CALLOC( unsigned, Abc_BitWordNum(2*Gia_ManCoNum(p->pAig)) );
9092
// allocate storage for terminary states
9193
p->nStateWords = Abc_BitWordNum( 2*Gia_ManRegNum(pAig) );
9294
p->vStates = Vec_PtrAlloc( 1000 );
@@ -754,4 +756,3 @@ Gia_Man_t * Gia_ManReduceConst( Gia_Man_t * pAig, int fVerbose )
754756

755757

756758
ABC_NAMESPACE_IMPL_END
757-

0 commit comments

Comments
 (0)