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

            Bug ID: 34147
           Summary: -Wtautological-compare /
                    -Wtautological-constant-out-of-range-compare is just
                    broken.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: lebedev...@gmail.com
                CC: llvm-bugs@lists.llvm.org

unsigned char draw[8];
unsigned short v;

int main() {
    static_assert(sizeof(unsigned short) == 2, "111");

    unsigned short* dest = (unsigned short*)(draw);

    if (dest[0] < 0 || dest[0] > 65535)
          (void)dest;
// Expected it to complain about both the comparisons.

    if (v < 0 || v > 65535)
          (void)dest;
// Expected it to complain about both the comparisons.

    if (v > 65536)
          (void)dest;
// But here it complains. Off by one.

    return 0;
};

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to