------- 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