[LLVMbugs] [Bug 8920] New: clang-analyzer can't deal with FD_SET and FD_ZERO

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 6 02:26:28 PST 2011


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

           Summary: clang-analyzer can't deal with FD_SET and FD_ZERO
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: asn at cryptomilk.org
                CC: llvmbugs at cs.uiuc.edu


clang-analyzer can't really deal with FD_SET and FD_ZERO. I think the problem
is cause these macros are assembler code.

Code:

rc = select(maxfd, &localset, NULL, NULL, timeout);

...

FD_ZERO(&localset2);
for (f = 0; f < maxfd; f++) {
  if (FD_ISSET(f, readfds) && FD_ISSET(f, &localset)) {
    FD_SET(f, &localset2);
  }
}

http://test.libssh.org/clang-analyzer/

Result:

Within the expansion of the macro 'FD_SET':
 The left expression of the compound assignment is an uninitialized value. The
computed value will also be garbage.

Test code:

If you're looking for some test code see the EXAMPLE section in the select(2)
manpage.

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