summaryrefslogtreecommitdiff
path: root/src/base
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/base
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/base')
-rw-r--r--src/base/cprintf_formats.hh1
-rw-r--r--src/base/debug.hh2
-rw-r--r--src/base/loader/elf_object.cc3
-rw-r--r--src/base/pollevent.cc1
-rw-r--r--src/base/statistics.hh6
-rw-r--r--src/base/vnc/vncserver.cc3
6 files changed, 10 insertions, 6 deletions
diff --git a/src/base/cprintf_formats.hh b/src/base/cprintf_formats.hh
index 6bf6b2b66..991238dee 100644
--- a/src/base/cprintf_formats.hh
+++ b/src/base/cprintf_formats.hh
@@ -65,6 +65,7 @@ struct Format
uppercase = false;
base = dec;
format = none;
+ float_format = best;
precision = -1;
width = 0;
get_precision = false;
diff --git a/src/base/debug.hh b/src/base/debug.hh
index 1cd64cfc2..20bf8e76d 100644
--- a/src/base/debug.hh
+++ b/src/base/debug.hh
@@ -66,7 +66,7 @@ class SimpleFlag : public Flag
public:
SimpleFlag(const char *name, const char *desc)
- : Flag(name, desc)
+ : Flag(name, desc), _status(false)
{ }
bool status() const { return _status; }
diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc
index 9445f1df9..4abf0a432 100644
--- a/src/base/loader/elf_object.cc
+++ b/src/base/loader/elf_object.cc
@@ -239,7 +239,8 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
ElfObject::ElfObject(const string &_filename, int _fd,
size_t _len, uint8_t *_data,
Arch _arch, OpSys _opSys)
- : ObjectFile(_filename, _fd, _len, _data, _arch, _opSys)
+ : ObjectFile(_filename, _fd, _len, _data, _arch, _opSys),
+ _programHeaderTable(0), _programHeaderSize(0), _programHeaderCount(0)
{
Elf *elf;
diff --git a/src/base/pollevent.cc b/src/base/pollevent.cc
index 9ed6df4fe..fb28d63d6 100644
--- a/src/base/pollevent.cc
+++ b/src/base/pollevent.cc
@@ -57,6 +57,7 @@ PollEvent::PollEvent(int _fd, int _events)
{
pfd.fd = _fd;
pfd.events = _events;
+ pfd.revents = 0;
}
PollEvent::~PollEvent()
diff --git a/src/base/statistics.hh b/src/base/statistics.hh
index fbf8ee769..8d6644284 100644
--- a/src/base/statistics.hh
+++ b/src/base/statistics.hh
@@ -1092,7 +1092,7 @@ class VectorBase : public DataWrapVec<Derived, VectorInfoProxy>
public:
VectorBase()
- : storage(NULL)
+ : storage(nullptr), _size(0)
{}
~VectorBase()
@@ -1232,7 +1232,7 @@ class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy>
public:
Vector2dBase()
- : storage(NULL)
+ : x(0), y(0), _size(0), storage(nullptr)
{}
~Vector2dBase()
@@ -1505,7 +1505,7 @@ class HistStor
/** The number of buckets.. */
size_type buckets;
- Params() : DistParams(Hist) {}
+ Params() : DistParams(Hist), buckets(0) {}
};
private:
diff --git a/src/base/vnc/vncserver.cc b/src/base/vnc/vncserver.cc
index 9ca575915..d11308875 100644
--- a/src/base/vnc/vncserver.cc
+++ b/src/base/vnc/vncserver.cc
@@ -106,7 +106,8 @@ VncServer::DataEvent::process(int revent)
*/
VncServer::VncServer(const Params *p)
: VncInput(p), listenEvent(NULL), dataEvent(NULL), number(p->number),
- dataFd(-1), sendUpdate(false)
+ dataFd(-1), sendUpdate(false),
+ supportsRawEnc(false), supportsResizeEnc(false)
{
if (p->port)
listen(p->port);