Earl Ou has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/12511 )

Change subject: Fix SConstruct for asan build
......................................................................

Fix SConstruct for asan build

Sometimes it's easier to debug gem5 built with ASan enabled. This CL fixes
some build error when using --with-asan.

Bug: None
Test: ./scripts/build_gem5 --with-asan --with-ubsan build/ARM/gem5.debug

Change-Id: Iaaaaebc3f25749e11f97bf454ddd0153b3de56e7
Reviewed-on: https://gem5-review.googlesource.com/12511
Reviewed-by: Jason Lowe-Power <[email protected]>
Reviewed-by: Anthony Gutierrez <[email protected]>
Maintainer: Anthony Gutierrez <[email protected]>
---
M SConstruct
M src/arch/arm/isa.hh
M src/cpu/reg_class.hh
3 files changed, 10 insertions(+), 10 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Anthony Gutierrez: Looks good to me, approved; Looks good to me, approved



diff --git a/SConstruct b/SConstruct
index 79522e4..f689b55 100755
--- a/SConstruct
+++ b/SConstruct
@@ -484,11 +484,11 @@
                 compareVersions(main['GCC_VERSION'], '4.9') >= 0:
             main.Append(CCFLAGS=['-fsanitize=address,undefined',
                                  '-fno-omit-frame-pointer'],
-                       LINKFLAGS='-fsanitize=address,undefined')
+                        LINKFLAGS='-fsanitize=address,undefined')
         else:
             main.Append(CCFLAGS=['-fsanitize=address',
                                  '-fno-omit-frame-pointer'],
-                       LINKFLAGS='-fsanitize=address')
+                        LINKFLAGS='-fsanitize=address')
     # Only gcc >= 4.9 supports UBSan, so check both the version
     # and the command-line option before adding the compiler and
     # linker flags.
@@ -541,16 +541,16 @@
     # versions here.
     if GetOption('with_ubsan'):
         if GetOption('with_asan'):
-            env.Append(CCFLAGS=['-fsanitize=address,undefined',
-                                '-fno-omit-frame-pointer'],
+            main.Append(CCFLAGS=['-fsanitize=address,undefined',
+                                 '-fno-omit-frame-pointer'],
                        LINKFLAGS='-fsanitize=address,undefined')
         else:
-            env.Append(CCFLAGS='-fsanitize=undefined',
-                       LINKFLAGS='-fsanitize=undefined')
+            main.Append(CCFLAGS='-fsanitize=undefined',
+                        LINKFLAGS='-fsanitize=undefined')

     elif GetOption('with_asan'):
-        env.Append(CCFLAGS=['-fsanitize=address',
-                            '-fno-omit-frame-pointer'],
+        main.Append(CCFLAGS=['-fsanitize=address',
+                             '-fno-omit-frame-pointer'],
                    LINKFLAGS='-fsanitize=address')

 else:
diff --git a/src/arch/arm/isa.hh b/src/arch/arm/isa.hh
index 0521c43..7b39682 100644
--- a/src/arch/arm/isa.hh
+++ b/src/arch/arm/isa.hh
@@ -461,7 +461,7 @@
                     return INTREG_SP0;
                   default:
                     panic("Invalid exception level");
-                    break;
+                    return 0;  // Never happens.
                 }
             } else {
                 return flattenIntRegModeIndex(reg);
diff --git a/src/cpu/reg_class.hh b/src/cpu/reg_class.hh
index 617d17e..69da9cf 100644
--- a/src/cpu/reg_class.hh
+++ b/src/cpu/reg_class.hh
@@ -84,7 +84,7 @@
     static constexpr size_t Scale = TheISA::NumVecElemPerVecReg;
     friend struct std::hash<RegId>;
   public:
-    RegId() {};
+    RegId() : regClass(IntRegClass), regIdx(0), elemIdx(-1) {}
     RegId(RegClass reg_class, RegIndex reg_idx)
         : regClass(reg_class), regIdx(reg_idx), elemIdx(-1)
     {

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12511
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: Iaaaaebc3f25749e11f97bf454ddd0153b3de56e7
Gerrit-Change-Number: 12511
Gerrit-PatchSet: 4
Gerrit-Owner: Earl Ou <[email protected]>
Gerrit-Reviewer: Anthony Gutierrez <[email protected]>
Gerrit-Reviewer: Earl Ou <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to