[LLVMbugs] [Bug 11732] New: Spurious ARC release of caught exception in @catch block

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 9 17:10:49 PST 2012


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

             Bug #: 11732
           Summary: Spurious ARC release of caught exception in @catch
                    block
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: paul.q.stevenson at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following fragment:

extern void Func();
int main() {
    @try {
        Func(); 
    } @catch(id x) {
    }
}

generates this llvm code when compiled with -fobjc-arc on the current
llvm/clang trunk:

define i32 @main() nounwind uwtable {
entry:
  %retval = alloca i32, align 4
  %exn.slot = alloca i8*
  %x = alloca i8*, align 8
  store i32 0, i32* %retval
  call void (...)* @Func()
  br label %eh.cont

eh.cont:                                          ; preds = %entry, %catch
  %0 = load i32* %retval
  ret i32 %0

catch:                                            ; No predecessors!
  %exn = load i8** %exn.slot
  %exn.adjusted = call i8* @objc_begin_catch(i8* %exn) nounwind
  store i8* %exn.adjusted, i8** %x
  %strongdestroy = load i8** %x
  call void @objc_release(i8* %strongdestroy) nounwind,
!clang.imprecise_release !0
  call void @objc_end_catch() nounwind
  br label %eh.cont
}

The catch block releases the caught exception, which appears contrary to Apple
docs (e.g.
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Exceptions/Tasks/HandlingExceptions.html)
and is different from the behavior of release 3.0

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