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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to