Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/15635

Change subject: base: Fix unitialized storage
......................................................................

base: Fix unitialized storage

The bitunion was not being initialized on constructor, and that
generated a maybe-unitialized error when being copied before
assigned in serialize's parseParam().

This patch adds a constructor to the BitfieldUndelyingClasses
so that its main (biggest) union entry is default initialized.

Change-Id: I90fa6aa356b3e14ec25e3294b17ed10f429a9a38
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/base/bitunion.hh
1 file changed, 3 insertions(+), 0 deletions(-)



diff --git a/src/base/bitunion.hh b/src/base/bitunion.hh
index 1a32991..8ef1c73 100644
--- a/src/base/bitunion.hh
+++ b/src/base/bitunion.hh
@@ -86,6 +86,8 @@
     Type getter(const Storage &storage) const = delete;
     void setter(Storage &storage, Type val) = delete;

+    BitfieldTypeImpl() : __storage() {}
+
     Storage __storage;

     operator Type () const
@@ -306,6 +308,7 @@
         friend BitfieldBackend::BitUnionBaseType< \
                 BitfieldUnderlyingClasses##name>; \
       public: \
+        BitfieldUnderlyingClasses##name() : __storage() {} \
         union { \
             type __storage;


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/15635
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I90fa6aa356b3e14ec25e3294b17ed10f429a9a38
Gerrit-Change-Number: 15635
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to