Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/52404 )
Change subject: mem-cache: Ensure all fields of the CacheBlk class are
initialized.
......................................................................
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
---
M src/mem/cache/cache_blk.hh
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/src/mem/cache/cache_blk.hh b/src/mem/cache/cache_blk.hh
index b3eed9a..775efbe 100644
--- a/src/mem/cache/cache_blk.hh
+++ b/src/mem/cache/cache_blk.hh
@@ -100,13 +100,13 @@
* 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 @@
std::list<Lock> lockList;
public:
- CacheBlk() : TaggedEntry(), data(nullptr), _tickInserted(0)
+ CacheBlk()
{
invalidate();
}
@@ -474,22 +474,22 @@
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;
};
/**
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/52404
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ie4c839504d49f9a131d8e3c3e8be02ff22f453a6
Gerrit-Change-Number: 52404
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s