[LLVMbugs] [Bug 7354] New: False positive due to lack of knowledge about sizeof()

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 11 04:38:25 CDT 2010


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

           Summary: False positive due to lack of knowledge about sizeof()
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: uspoerlein at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Hi,

I think I spotted a false positive, involving sizeof. Report is here:

https://www.spoerlein.net/scan-build/freebsd-head/bin.pax/2010-06-05-1/report-jkFr8u.html#EndPath

The code is:

1262        for (i = 0; i < steps; ++i) {
        3    Loop condition is true.  Entering loop body

1263            end = pt + sizeof(u_int);
1264            dest = (char *)&val;
1265            while (pt < end)
        4    Loop condition is false. Execution continues on line 1267

1266                *dest++ = *pt++;
1267            key += val;
        5    Assigned value is garbage or undefined

1268        }

And the problem AFAICS is step 4, where it thinks pt can be >= end, which
should be impossible due to line 1263.

I'm not sure if sizeof() can ever return 0, but at least for u_int it can't :)

Regards,
Uli

-- 
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 LLVMbugs mailing list