Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38707 )

Change subject: base: Fix uninitialized variable in Flag
......................................................................

base: Fix uninitialized variable in Flag

This was uninitialized, and was breaking expected values
under certain situations.

Change-Id: If51ab6ae038c7c397bc83de1c73af348c1db4ef8
Signed-off-by: Daniel R. Carvalho <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38707
Reviewed-by: Bobby R. Bruce <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Bobby R. Bruce <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/base/debug.cc
M src/base/debug.hh
2 files changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/debug.cc b/src/base/debug.cc
index 45d9f9d..9cfd45e 100644
--- a/src/base/debug.cc
+++ b/src/base/debug.cc
@@ -100,6 +100,8 @@
         panic("Flag %s already defined!", name);

     ++allFlagsVersion;
+
+    sync();
 }

 Flag::~Flag()
diff --git a/src/base/debug.hh b/src/base/debug.hh
index 7cc7137..6006b14 100644
--- a/src/base/debug.hh
+++ b/src/base/debug.hh
@@ -82,15 +82,13 @@
 class SimpleFlag : public Flag
 {
   protected:
-    bool _tracing; // tracing is enabled and flag is on
-    bool _status;  // flag status
+    bool _tracing = false; // tracing is enabled and flag is on
+    bool _status = false;  // flag status

     void sync() override { _tracing = _globalEnable && _status; }

   public:
-    SimpleFlag(const char *name, const char *desc)
-        : Flag(name, desc), _status(false)
-    { }
+    SimpleFlag(const char *name, const char *desc) : Flag(name, desc) {}

     bool status() const override { return _tracing; }


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38707
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: If51ab6ae038c7c397bc83de1c73af348c1db4ef8
Gerrit-Change-Number: 38707
Gerrit-PatchSet: 4
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Gabe Black <[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

Reply via email to