From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20342 invoked by alias); 9 Oct 2006 14:25:46 -0000 Received: (qmail 20220 invoked by uid 48); 9 Oct 2006 14:25:36 -0000 Date: Mon, 09 Oct 2006 14:25:00 -0000 Message-ID: <20061009142536.20218.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug rtl-optimization/29323] [4.0/4.1/4.2 Regression] set_nothrow_function_flags does invalid analysis on weak functions In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-10/txt/msg00705.txt.bz2 List-Id: ------- Comment #5 from rguenth at gcc dot gnu dot org 2006-10-09 14:25 ------- The frontend marks foo () TREE_STATIC in start_preparsed_function () and later TREE_NOTHROW in finish_function () because /* 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; where cp_function_chain->can_throw is 0 (its initial value(?)). Fixing that and the RTL problem fixes the testcase. I am, of course, not sure if the C++ frontend fix is ok. Index: except.c =================================================================== --- except.c (revision 117569) +++ except.c (working copy) @@ -2787,6 +2787,9 @@ set_nothrow_function_flags (void) { 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) @@ -11081,7 +11081,8 @@ finish_function (int flags) /* If this function can't throw any exceptions, remember that. */ if (!processing_template_decl && !cp_function_chain->can_throw - && !flag_non_call_exceptions) + && !flag_non_call_exceptions + && targetm.binds_local_p (fndecl)) TREE_NOTHROW (fndecl) = 1; /* This must come after expand_function_end because cleanups might -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2006-10-03 05:26:42 |2006-10-09 14:25:36 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29323