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

            Bug ID: 22901
           Summary: No Warning on logical ‘and’ of mutually exclusive
                    tests
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

The condition "(a > 0 && a < -1)" is always false. Gcc emits a warning, but
Clang currently has not supported this yet. 

$: cat t.c
int f(int a) {
  return (a > 0 && a < -1) ? 0 : 1;
}
$: clang-trunk -c -Weverything -Wno-missing-prototypes t.c
$: gcc-trunk -c -Wlogical-op t.c
t.c: In function ‘f’:
t.c:2:17: warning: logical ‘and’ of mutually exclusive tests is always false
[-Wlogical-op]
   return (a > 0 && a < -1) ? 0 : 1;
                 ^
$:

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to