Earl Ou has uploaded this change for review. ( 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.

Change-Id: Iaaaaebc3f25749e11f97bf454ddd0153b3de56e7
---
M SConstruct
M src/arch/arm/isa.hh
2 files changed, 13 insertions(+), 11 deletions(-)



diff --git a/SConstruct b/SConstruct
index 79522e4..7805862 100755
--- a/SConstruct
+++ b/SConstruct
@@ -483,12 +483,14 @@
         if GetOption('with_ubsan') and \
                 compareVersions(main['GCC_VERSION'], '4.9') >= 0:
             main.Append(CCFLAGS=['-fsanitize=address,undefined',
-                                 '-fno-omit-frame-pointer'],
-                       LINKFLAGS='-fsanitize=address,undefined')
+                                 '-fno-omit-frame-pointer',
+                                 '-Wno-error=maybe-uninitialized'],
+                        LINKFLAGS='-fsanitize=address,undefined')
         else:
             main.Append(CCFLAGS=['-fsanitize=address',
-                                 '-fno-omit-frame-pointer'],
-                       LINKFLAGS='-fsanitize=address')
+                                 '-fno-omit-frame-pointer',
+                                 '-Wno-error=maybe-uninitialized'],
+                        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 +543,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 9158b62..9213234 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);

--
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: 1
Gerrit-Owner: Earl Ou <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to