[LLVMbugs] [Bug 19125] New: -Wconstant-logical-operand false positive when using "if (... || 0)" or "if (... || 1)"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 13 03:36:37 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19125

            Bug ID: 19125
           Summary: -Wconstant-logical-operand false positive when using
                    "if (... || 0)" or "if (... || 1)"
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

lib/asan/asan_poisoning.h:
 46   if (value ||
 47       SANITIZER_WINDOWS ||
 48       shadow_end - shadow_beg <
common_flags()->clear_shadow_mmap_threshold) {
where SANITIZER_WINDOWS is "# define SANITIZER_WINDOWS 0" on Linux
yields
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/15156/steps/compile/logs/stdio
  COMPILE:   clang_linux/asan-i386/i386:
/home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/projects/compiler-rt/lib/asan/asan_linux.cc
In file included from
/home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/projects/compiler-rt/lib/asan/asan_globals.cc:17:
/home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/projects/compiler-rt/lib/asan/asan_poisoning.h:46:13:
error: use of logical '||' with constant operand
[-Werror,-Wconstant-logical-operand]
  if (value ||
            ^
/home/llvmbb/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/projects/compiler-rt/lib/asan/asan_poisoning.h:46:13:
note: use '|' for a bitwise operation
  if (value ||
            ^~
            |

I believe this is a false positive -Wconstant-logical-operand.

-- 
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/20140313/3f001c71/attachment.html>


More information about the llvm-bugs mailing list