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

            Bug ID: 42666
           Summary: Clang doesn't warn on some obviously tautological
                    comparisons
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: chandl...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

https://godbolt.org/z/iocaCS

```
#include <stdlib.h>

enum Flags {
    FLAG_A = 0b001,
    FLAG_B = 0b010,
    FLAG_C = 0b100,
};

void a();
void b();
void c();

void f(Flags f) {
    if (!!(f | FLAG_A)) {
        a();
    } else if (!!(f | FLAG_B)) {
        b();
    } else if (!!(f | FLAG_C)) {
        c();
    } else {
        abort();
    }
}
```

See also: https://twitter.com/dvyukov/status/1151748350120779781

-- 
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