This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug objc/22606] New: Exceptions cannot be thrown from -forward::


When @throw'ing form -forward:: method, the unwinding will stop at -forward
method with code == _URC_END_OF_STACK in gcc/unwind.inc:_Unwind_RaiseException

This code aborts while throwing. (compiled with -fobjc-exceptions of course)
-----------------------------------------------------------
#import <objc/Object.h>
#import <objc/objc-api.h>

@interface Thrower : Object
- forward: (SEL) s : (arglist_t) a;
@end

@implementation Thrower
- forward: (SEL) s : (arglist_t) a
{
        printf("Forwarding %s\n", sel_get_name(s));
        @throw [Object new];
}
@end


int
main()
{
        id t = [Thrower new];
        @try
        {
                [t doesnotexist];
        }
        @catch (id error)
        {
                printf("Got error class %s\n", [[error class] name]);
                [error free];
        }
}
-----------------------------------------------------

-- 
           Summary: Exceptions cannot be thrown from -forward::
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: objc
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: creep at desk dot pl
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]