[LLVMbugs] [Bug 13635] New: Block (NSError **)error return in ARC crashes due to zombie object

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 17 22:00:03 PDT 2012


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

             Bug #: 13635
           Summary: Block (NSError **)error return in ARC crashes due to
                    zombie object
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jim.correia at pobox.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9069
  --> http://llvm.org/bugs/attachment.cgi?id=9069
Sample code

Details:

      -processArray:error: would have been problematic with manual
      retain/release code, since localError is a zombie by the time it
      is assigned to *error. This method actually works fine when ARC is
      enabled, which is great.

      -buggyArcProcessArray:error: fails under ARC though. The value
      assigned to *error is autoreleased, and deallocated, before
      returning to the caller.

      Since we tend to think less about references when building with
      ARC, it would be great if this could be made to just work.

      However, if it cannot, it would be nice if the compiler could
      issue a warning that assigning to *error inside the block is a bad
      idea, and suggest using the __block local to keep a reference to
      the object alive.

   Compiler version:

      % xcrun clang -v
      Apple clang version 4.0 (tags/Apple/clang-421.10.60) (based on LLVM
3.1svn)
      Target: x86_64-apple-darwin12.0.0
      Thread model: posix

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