[llvm-bugs] [Bug 33003] New: Linux::getSupportedSanitizers logic bug

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 11 06:34:40 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33003

            Bug ID: 33003
           Summary: Linux::getSupportedSanitizers logic bug
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: steven at uplinklabs.net
                CC: llvm-bugs at lists.llvm.org

Noticed due to new warnings in GCC 7.1.1:

[3005/4646] Building CXX object
tools/clang/lib/Driver/CMakeFiles/clangDriver.dir/ToolChains/Linux.cpp.o
../tools/clang/lib/Driver/ToolChains/Linux.cpp: In member function ‘virtual
clang::SanitizerMask clang::driver::toolchains::Linux::getSupportedSanitizers()
const’:
../tools/clang/lib/Driver/ToolChains/Linux.cpp:868:40: warning: enum constant
in boolean context [-Wint-in-bool-context]
                          llvm::Triple::thumb || llvm::Triple::armeb ||
                                        ^~~~~
../tools/clang/lib/Driver/ToolChains/Linux.cpp:868:63: warning: enum constant
in boolean context [-Wint-in-bool-context]
                          llvm::Triple::thumb || llvm::Triple::armeb ||
                                                               ^~~~~
../tools/clang/lib/Driver/ToolChains/Linux.cpp:869:40: warning: enum constant
in boolean context [-Wint-in-bool-context]
                          llvm::Triple::thumbeb;
                                        ^~~~~~~

This should fix it:

diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index 50443a1252..6708505d75 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -865,8 +865,9 @@ SanitizerMask Linux::getSupportedSanitizers() const {
   const bool IsAArch64 = getTriple().getArch() == llvm::Triple::aarch64 ||
                          getTriple().getArch() == llvm::Triple::aarch64_be;
   const bool IsArmArch = getTriple().getArch() == llvm::Triple::arm ||
-                         llvm::Triple::thumb || llvm::Triple::armeb ||
-                         llvm::Triple::thumbeb;
+                         getTriple().getArch() == llvm::Triple::thumb ||
+                         getTriple().getArch() == llvm::Triple::armeb ||
+                         getTriple().getArch() == llvm::Triple::thumbeb;
   SanitizerMask Res = ToolChain::getSupportedSanitizers();
   Res |= SanitizerKind::Address;
   Res |= SanitizerKind::Fuzzer;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170511/e38f4d5b/attachment.html>


More information about the llvm-bugs mailing list