[llvm-commits] [llvm-gcc-4.2] r85649 - /llvm-gcc-4.2/trunk/gcc/cp/decl.c

Bill Wendling isanbard at gmail.com
Sat Oct 31 02:27:06 PDT 2009


Author: void
Date: Sat Oct 31 04:27:06 2009
New Revision: 85649

URL: http://llvm.org/viewvc/llvm-project?rev=85649&view=rev
Log:
When marking something as "nothrow", make sure that we're not blindly marking a
"thunk" as nothrow. It should have the same nothrow setting as the function that
it's thunking. This is because LLVM doesn't generate the add/jmp instruction
sequence that gcc does; it's actually a function which calls the thunkee. If the
thunkee can throw but the thunk is marked as "nothrow", then no EH information
will be generated for the thunk, and exceptions will go blammo!

Testcase to follow within a few days.

Modified:
    llvm-gcc-4.2/trunk/gcc/cp/decl.c

Modified: llvm-gcc-4.2/trunk/gcc/cp/decl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl.c?rev=85649&r1=85648&r2=85649&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/decl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/decl.c Sat Oct 31 04:27:06 2009
@@ -12102,7 +12102,18 @@
       && !cp_function_chain->can_throw
       && !flag_non_call_exceptions
       && !DECL_REPLACEABLE_P (fndecl))
-    TREE_NOTHROW (fndecl) = 1;
+    /* LLVM LOCAL begin - set nothrow for thunks to what it is for the
+       function that they're thunking.  */
+    {
+#ifdef ENABLE_LLVM
+      if (DECL_THUNK_P (fndecl))
+        TREE_NOTHROW (fndecl) = TREE_NOTHROW (THUNK_TARGET (fndecl));
+      else
+#endif
+        TREE_NOTHROW (fndecl) = 1;
+    }
+    /* LLVM LOCAL end - set nothrow for thunks to what it is for the
+       function that they're thunking.  */
 
   /* This must come after expand_function_end because cleanups might
      have declarations (from inline functions) that need to go into





More information about the llvm-commits mailing list