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: unassignedclangb...@nondot.org
          Reporter: tangyix...@mail.dlut.edu.cn
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to