[llvm-bugs] [Bug 43573] New: no warnings for -Wtautological-compare

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 5 05:59:47 PDT 2019


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

            Bug ID: 43573
           Summary: no warnings for -Wtautological-compare
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tangyixuan at mail.dlut.edu.cn
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

clang-10 falls to emit the warning for the following:

$ cat s.c
  int main(){
    int a;
    int b = (0!=((-1)|((a = 1) == 1)));
    return 0;
  }

$ clang-10 -Wtautological-compare  s.c

clang version 10.0.0 (https://github.com/llvm/llvm-project.git
49c4e58b75ecec8dce75dd13c61aaeb30e14b531)
Target: x86_64-unknown-linux-gnu
Thread model: posix


$ gcc-9.1 -Wtautological-compare s.c
s.c:3:12: warning:bitwise comparison always evaluates to true
[-Wtautological-compare]
    3 |  int b = (0!=((-1)|((c = 1) == 1)));
       |               ^~

-- 
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/20191005/b25c6b35/attachment.html>


More information about the llvm-bugs mailing list