Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/52404 )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52404
Reviewed-by: Jason Lowe-Power <[email protected]>
Reviewed-by: Daniel Carvalho <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/mem/cache/cache_blk.hh
1 file changed, 29 insertions(+), 8 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
Daniel Carvalho: Looks good to me, approved
kokoro: Regressions pass
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: 3
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s