summaryrefslogtreecommitdiff
path: root/src/mem/cache/prefetch
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-09-09 04:36:31 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2014-09-09 04:36:31 -0400
commitda4539dc749c3d29c03de9b3130f1c9a7266be9d (patch)
treec58cfe7bb1b489f440883cb4ec8a2a25e546aa20 /src/mem/cache/prefetch
parent346fe7337009980566e023a60a09391ed893a5c0 (diff)
downloadgem5-da4539dc749c3d29c03de9b3130f1c9a7266be9d.tar.xz
misc: Fix a number of unitialised variables and members
Static analysis unearther a bunch of uninitialised variables and members, and this patch addresses the problem. In all cases these omissions seem benign in the end, but at least fixing them means less false positives next time round.
Diffstat (limited to 'src/mem/cache/prefetch')
-rw-r--r--src/mem/cache/prefetch/base.cc4
-rw-r--r--src/mem/cache/prefetch/base.hh2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc
index 57c1424bf..971ecf5b0 100644
--- a/src/mem/cache/prefetch/base.cc
+++ b/src/mem/cache/prefetch/base.cc
@@ -57,7 +57,8 @@
#include "sim/system.hh"
BasePrefetcher::BasePrefetcher(const Params *p)
- : ClockedObject(p), size(p->size), latency(p->latency), degree(p->degree),
+ : ClockedObject(p), size(p->size), cache(nullptr), blkSize(0),
+ latency(p->latency), degree(p->degree),
useMasterId(p->use_master_id), pageStop(!p->cross_pages),
serialSquash(p->serial_squash), onlyData(p->data_accesses_only),
onMissOnly(p->on_miss_only), onReadOnly(p->on_read_only),
@@ -69,6 +70,7 @@ BasePrefetcher::BasePrefetcher(const Params *p)
void
BasePrefetcher::setCache(BaseCache *_cache)
{
+ assert(!cache);
cache = _cache;
blkSize = cache->getBlockSize();
}
diff --git a/src/mem/cache/prefetch/base.hh b/src/mem/cache/prefetch/base.hh
index fc0dd0b36..22a4c68f6 100644
--- a/src/mem/cache/prefetch/base.hh
+++ b/src/mem/cache/prefetch/base.hh
@@ -83,7 +83,7 @@ class BasePrefetcher : public ClockedObject
BaseCache* cache;
/** The block size of the parent cache. */
- int blkSize;
+ unsigned blkSize;
/** The latency before a prefetch is issued */
const Cycles latency;