[cfe-commits] [libcxxabi] r149389 - in /libcxxabi/trunk/src: cxa_personality.cpp temporary.cpp

Howard Hinnant hhinnant at apple.com
Tue Jan 31 09:15:14 PST 2012


Author: hhinnant
Date: Tue Jan 31 11:15:14 2012
New Revision: 149389

URL: http://llvm.org/viewvc/llvm-project?rev=149389&view=rev
Log:
Found and fixed bug in personality function:  Don't dive into the action table if the action entry is zero.

Modified:
    libcxxabi/trunk/src/cxa_personality.cpp
    libcxxabi/trunk/src/temporary.cpp

Modified: libcxxabi/trunk/src/cxa_personality.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=149389&r1=149388&r2=149389&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_personality.cpp (original)
+++ libcxxabi/trunk/src/cxa_personality.cpp Tue Jan 31 11:15:14 2012
@@ -519,8 +519,7 @@
             if (actionEntry == 0)
             {
                 // Found a cleanup
-                // If this is a type 1 or type 2 search, ignore the clean up
-                //    and continue to scan for a handler.
+                // If this is a type 1 or type 2 search, there are no handlers
                 // If this is a type 3 search, you want to install the cleanup.
                 if ((actions & _UA_CLEANUP_PHASE) && !(actions & _UA_HANDLER_FRAME))
                 {
@@ -529,6 +528,9 @@
                     results.reason = _URC_HANDLER_FOUND;
                     return;
                 }
+                // No handler here
+                results.reason = _URC_CONTINUE_UNWIND;
+                return;
             }
             // Convert 1-based byte offset into
             const uint8_t* action = actionTableStart + (actionEntry - 1);
@@ -814,7 +816,9 @@
                 results.adjustedPtr = exception_header->adjustedPtr;
             }
             else
+            {
                 scan_eh_tab(results, actions, native_exception, unwind_exception, context);
+            }
             _Unwind_SetGR(context, __builtin_eh_return_data_regno(0), (uintptr_t)unwind_exception);
             _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), results.ttypeIndex);
             _Unwind_SetIP(context, results.landingPad);

Modified: libcxxabi/trunk/src/temporary.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/temporary.cpp?rev=149389&r1=149388&r2=149389&view=diff
==============================================================================
--- libcxxabi/trunk/src/temporary.cpp (original)
+++ libcxxabi/trunk/src/temporary.cpp Tue Jan 31 11:15:14 2012
@@ -15,14 +15,26 @@
 {
 
 static
-void f()
+void f1()
 {
-    abort_message("this shouldn't be called");
+    abort_message("__cxa_new_handler shouldn't be called");
 }
 
-void (*__cxa_new_handler)() = f;
-void (*__cxa_terminate_handler)() = f;
-void (*__cxa_unexpected_handler)() = f;
+static
+void f2()
+{
+    abort_message("__cxa_terminate_handler shouldn't be called");
+}
+
+static
+void f3()
+{
+    abort_message("__cxa_unexpected_handler shouldn't be called");
+}
+
+void (*__cxa_new_handler)() = f1;
+void (*__cxa_terminate_handler)() = f2;
+void (*__cxa_unexpected_handler)() = f3;
 
 }
 





More information about the cfe-commits mailing list