http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56870



             Bug #: 56870

           Summary: @catch handler broken with SEH

    Classification: Unclassified

           Product: gcc

           Version: 4.8.1

            Status: UNCONFIRMED

          Severity: blocker

          Priority: P3

         Component: objc

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: js-...@webkeks.org





When trying to use ObjC exceptions with the new SEH support, the caught object

is not the ObjC object, but the _Unwind_Exception instead. Example:



@try {

    id e = [Object new];

    printf("@throw %p\n", e);

    @throw e;

} @catch (id e) {

    printf("@catch %p\n", e);

    @throw e;

}



Expected behaviour: Both are the same pointer.

Observed behaviour: They differ.



Looking further into it, the second pointer is the pointer to the

_Unwind_Exception (I added debug code in objc_exception_throw that outputs the

pointer after the malloc. It is always the same that's received in the catch).



So it seems the generated landing pad for ObjC code is wrong when using SEH. I

think it is correct that the landing pad receives the _Unwind_Exception and not

the ObjC object. But the landing pad needs to get the ObjC exception out of the

_Unwind_Exception and give that back to the user instead of the

_Unwind_Exception, which the user should never see.



This seems to happen not only with 4.8, but also with 4.9.



I marked this bug as blocker, as 4.8 made SEH the default, effectively breaking

ObjC execptions on Windows.

Reply via email to