C++ PATCH for c++/49260 (lambda-eh2.C failure on several targets)

Message ID 4E3818A1.7070906@redhat.com
State New
Headers show

Commit Message

Jason Merrill Aug. 2, 2011, 3:32 p.m.
On 06/22/2011 11:50 AM, Jason Merrill wrote:
> This failure was happening on all targets that don't use either CFI
> assembler directives or asynchronous unwind tables: we were mistakenly
> deciding that the _FUN thunk for returning from the lambda function
> pointer conversion operator couldn't throw because build_call_a wasn't
> setting cp_function_chain->can_throw. There seems to be no reason to set
> that flag in build_cxx_call rather than build_call_a, so I've moved it.

Looking at this again before applying it to 4.6.2, I'm not sure that 
it's safe to drop the at_function_scope_p() check, so I'm going to put 
it back in to be safe.

Tested x86_64-pc-linux-gnu, applying to trunk and 4.6.2.


commit 631465c6d70a602d274e760af7912ad384f67750
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Aug 2 09:06:05 2011 -0400

    	* call.c (build_call_a): Also check at_function_scope_p.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 2eab782..b0133e2 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -352,7 +352,7 @@  build_call_a (tree function, int n, tree *argarray)
   nothrow = ((decl && TREE_NOTHROW (decl))
 	     || TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (function))));
-  if (!nothrow && cfun && cp_function_chain)
+  if (!nothrow && at_function_scope_p () && cfun && cp_function_chain)
     cp_function_chain->can_throw = 1;
   if (decl && TREE_THIS_VOLATILE (decl) && cfun && cp_function_chain)