[LLVMbugs] [Bug 13865] New: Interprocedural analysis false positive

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 18 07:49:29 PDT 2012


             Bug #: 13865
           Summary: Interprocedural analysis false positive
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: timac at timac.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 9225
  --> http://llvm.org/bugs/attachment.cgi?id=9225
Xcode project

The Clang Static Analyzer reports a memory leak for the following source code.

Steps to reproduce:
1- On 10.8.1 with Xcode 4.4.1, create a new CoreFoundation project with ARC
2- Download the attached Xcode project or replace the main.c with a main.cpp
containing the following:

#include <CoreFoundation/CoreFoundation.h>

class MyCFURLWrapper
    MyCFURLWrapper() : mRef(NULL) { }

        if (mRef != NULL)
            mRef = NULL;

    void Adopt( CFURLRef inURLRef )
        if (mRef != inURLRef)
            if (mRef != NULL)

            mRef = inURLRef;

    CFURLRef mRef;

int main(int argc, const char * argv[])
        MyCFURLWrapper urlWrapper;
        CFURLRef theURLRef =

    return 0;

3- Run scan-build /usr/bin/xcodebuild -project InterproceduralBug.xcodeproj
-target "InterproceduralBug" build

The Clang static analyzer reports a memory leak.

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