Skip to content

no warnings for -Wtautological-compare #42918

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 43573
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@zygoloid,@Weverything

Extended Description

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 49c4e58)
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)));
       |               ^~

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillaclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions