[LLVMbugs] [Bug 10199] New: Static analyzer fails to track path invariants involving bitmasks.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 26 16:30:16 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10199

           Summary: Static analyzer fails to track path invariants
                    involving bitmasks.
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: juli at clockworksquid.com
                CC: llvmbugs at cs.uiuc.edu


%%%
void f(unsigned);
void g(unsigned, unsigned);

void
f(unsigned flags)
{
    unsigned inbytes, outbytes;

    if ((flags & 1) != 0)
        inbytes = outbytes = 0;

    if ((flags & 1) != 0)
        g(inbytes, outbytes);
}
%%%

Yields:

%%%
x.cc:13:3: warning: Function call argument is an uninitialized value
                g(inbytes, outbytes);
%%%

Eliminating the bitmask (i.e. "if (flags != 0)") the analyzer detects that
inbytes and outbytes are always initialized.

Version:

%%%
clang version 3.0 (trunk 133679)
Target: x86_64-apple-darwin10.7.0
Thread model: posix
%%%

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