[LLVMbugs] [Bug 10721] New: false positive in comparison with cast

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 23 03:45:14 PDT 2011


           Summary: false positive in comparison with cast
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: mattiase at acm.org
                CC: llvmbugs at cs.uiuc.edu

clang version 3.0 (trunk 138324)
Target: x86_64-unknown-linux-gnu

Running this through the static analyser:

struct S { unsigned long long x; };
int f(struct S *p) {
    if (p->x != (unsigned)p->x)
        return 1;
        return 2;

yields the warning:

clangbug.c:3:14: warning: Both operands to '!=' always have the same value
    if (p->x != (unsigned)p->x)
        ~~~~ ^  ~~~~~~~~~~~~~~

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list