This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][C++] Fix PR29323, wrong-code with weak functions and exceptions
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 9 Oct 2006 18:07:20 +0200 (CEST)
- Subject: [PATCH][C++] Fix PR29323, wrong-code with weak functions and exceptions
This fixes PR29323 where we wrongly conclude that a weak function
cannot throw. The problem is two-fold, for once the C++ frontend
sets TREE_NOTHROW on the function decl, for another the rtl pass
set_nothrow_function_flags sets it, too. Both fail to check for
weak functions.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
Ok for mainline and branches?
Thanks,
Richard.
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
:ADDPATCH c++:
2006-10-09 Richard Guenther <rguenther@suse.de>
PR rtl-optimization/29323
* except.c (set_nothrow_function_flags): For functions
that do not bind local bail out early.
* decl.c (finish_function): Set TREE_NOTHROW only for
functions that bind local.
Index: except.c
===================================================================
*** except.c (revision 117569)
--- except.c (working copy)
*************** set_nothrow_function_flags (void)
*** 2787,2792 ****
--- 2787,2795 ----
{
rtx insn;
+ if (!targetm.binds_local_p (current_function_decl))
+ return 0;
+
TREE_NOTHROW (current_function_decl) = 1;
/* Assume cfun->all_throwers_are_sibcalls until we encounter
Index: cp/decl.c
===================================================================
*** cp/decl.c (revision 117569)
--- cp/decl.c (working copy)
*************** finish_function (int flags)
*** 11081,11087 ****
/* If this function can't throw any exceptions, remember that. */
if (!processing_template_decl
&& !cp_function_chain->can_throw
! && !flag_non_call_exceptions)
TREE_NOTHROW (fndecl) = 1;
/* This must come after expand_function_end because cleanups might
--- 11081,11088 ----
/* If this function can't throw any exceptions, remember that. */
if (!processing_template_decl
&& !cp_function_chain->can_throw
! && !flag_non_call_exceptions
! && targetm.binds_local_p (fndecl))
TREE_NOTHROW (fndecl) = 1;
/* This must come after expand_function_end because cleanups might