mem-cache: Ensure all fields of the CacheBlk class are initialized.
The constructor only initialized two fields, data and _tickInserted. The print() method at least accesses the coherence status bits, which valgrind determined were being accessed without being initialized. This change adds a default initializer to all fields to prevent any value from flapping around uninitialized. Change-Id: Ie4c839504d49f9a131d8e3c3e8be02ff22f453a6 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52404 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
16
src/mem/cache/cache_blk.hh
vendored
16
src/mem/cache/cache_blk.hh
vendored
@@ -100,13 +100,13 @@ class CacheBlk : public TaggedEntry
|
||||
* data stored here should be kept consistant with the actual data
|
||||
* referenced by this block.
|
||||
*/
|
||||
uint8_t *data;
|
||||
uint8_t *data = nullptr;
|
||||
|
||||
/**
|
||||
* Which curTick() will this block be accessible. Its value is only
|
||||
* meaningful if the block is valid.
|
||||
*/
|
||||
Tick whenReady;
|
||||
Tick whenReady = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -152,7 +152,7 @@ class CacheBlk : public TaggedEntry
|
||||
std::list<Lock> lockList;
|
||||
|
||||
public:
|
||||
CacheBlk() : TaggedEntry(), data(nullptr), _tickInserted(0)
|
||||
CacheBlk()
|
||||
{
|
||||
invalidate();
|
||||
}
|
||||
@@ -474,22 +474,22 @@ class CacheBlk : public TaggedEntry
|
||||
|
||||
private:
|
||||
/** Task Id associated with this block */
|
||||
uint32_t _taskId;
|
||||
uint32_t _taskId = 0;
|
||||
|
||||
/** holds the source requestor ID for this block. */
|
||||
int _srcRequestorId;
|
||||
int _srcRequestorId = 0;
|
||||
|
||||
/** Number of references to this block since it was brought in. */
|
||||
unsigned _refCount;
|
||||
unsigned _refCount = 0;
|
||||
|
||||
/**
|
||||
* Tick on which the block was inserted in the cache. Its value is only
|
||||
* meaningful if the block is valid.
|
||||
*/
|
||||
Tick _tickInserted;
|
||||
Tick _tickInserted = 0;
|
||||
|
||||
/** Whether this block is an unaccessed hardware prefetch. */
|
||||
bool _prefetched;
|
||||
bool _prefetched = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user