Index: src/runtime/exception.m ================================================================== --- src/runtime/exception.m +++ src/runtime/exception.m @@ -396,11 +396,10 @@ static uint8_t find_actionrecord(const uint8_t *actionrecords, struct lsda *lsda, int actions, BOOL foreign, struct objc_exception *e, intptr_t *filtervalue) { - uint8_t found = 0; const uint8_t *ptr; intptr_t filter, displacement; do { ptr = actionrecords; @@ -440,19 +439,19 @@ class = (c != 0 ? objc_get_class((const char*)c) : Nil); if (class_matches(class, e->object)) { *filtervalue = filter; - return (found | HANDLER_FOUND); + return HANDLER_FOUND; } } else if (filter == 0) - found |= CLEANUP_FOUND; + return CLEANUP_FOUND; else abort(); } while (displacement != 0); - return found; + return 0; } #if defined(__arm__) || defined(__ARM__) _Unwind_Reason_Code __gnu_objc_personality_v0(uint32_t state, struct _Unwind_Exception *ex, @@ -537,15 +536,15 @@ found = CLEANUP_FOUND; else if (landingpad != 0) found = find_actionrecord(actionrecords, &lsda, actions, foreign, e, &filter); - if (!found || foreign) + if (!found) CONTINUE_UNWIND; if (actions & _UA_SEARCH_PHASE) { - if (!(found & HANDLER_FOUND)) + if (!(found & HANDLER_FOUND) || foreign) CONTINUE_UNWIND; /* Cache it so we don't have to search it again in phase 2 */ #if defined(__arm__) || defined(__ARM__) ex->barrier_cache.sp = _Unwind_GetGR(ctx, 13); @@ -560,15 +559,14 @@ } else if (actions & _UA_CLEANUP_PHASE) { if (!(found & CLEANUP_FOUND)) CONTINUE_UNWIND; _Unwind_SetGR(ctx, __builtin_eh_return_data_regno(0), - (uintptr_t)e->object); + (uintptr_t)ex); _Unwind_SetGR(ctx, __builtin_eh_return_data_regno(1), filter); _Unwind_SetIP(ctx, landingpad); - free(ex); return _URC_INSTALL_CONTEXT; } abort();