[LLVMbugs] [Bug 14594] New: False Alarm in BSD's mergesort-Implementation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 13 05:54:27 PST 2012


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

             Bug #: 14594
           Summary: False Alarm in BSD's mergesort-Implementation
           Product: clang
           Version: 3.2
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: halbanonym at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9694
  --> http://llvm.org/bugs/attachment.cgi?id=9694
unmodified source code from BSD/OSX implementation

Clang static analyzer reports a false alarm about a "logic error" in BSD's
implementation of mergesort (this implementation is used for OSX's libSystem):


merge.c:219:9: Assigned value is garbage or undefined
merge.c:115:6: Assuming 'nmemb' is not equal to 0
merge.c:136:29: Assuming 'p2' is equal to 'last'
merge.c:133:2: Looping back to the head of the loop
merge.c:136:29: Assuming 'p2' is equal to 'last'
merge.c:133:2: Looping back to the head of the loop
merge.c:136:29: Assuming 'p2' is equal to 'last'
merge.c:133:2: Looping back to the head of the loop
merge.c:136:29: Assuming 'p2' is not equal to 'last'
merge.c:143:14: Assuming 'f1' is >= 'l1'                       <<<-- i.e.
assume  A ...
merge.c:215:18: Assuming 'f1' is < 'l1'                        <<<-- ... 
assume !A
merge.c:219:9: Assigned value is garbage or undefined


Please note the last messages where the analyzer first assumes f1>=l1 and then
f1<l1 which isn't possible since neither f1 nor l1 are updated.

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