aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-10-31 13:38:41 -0400
committerJason Merrill <jason@redhat.com>2022-10-31 21:23:17 -0400
commit43c40f114a68edc9a9cc9963dc940c11806ff863 (patch)
treeb2c4b2a085e1df76de2e09f904380b377f3430a1
parent6a1f27f45e44bcfbcc06a1aad74bb076e56eda36 (diff)
downloadgcc-43c40f114a68edc9a9cc9963dc940c11806ff863.zip
gcc-43c40f114a68edc9a9cc9963dc940c11806ff863.tar.gz
gcc-43c40f114a68edc9a9cc9963dc940c11806ff863.tar.bz2
c++: set TREE_NOTHROW after genericize
genericize might introduce function calls (and does on the contracts branch), so it's safer to set this flag later. gcc/cp/ChangeLog: * decl.cc (finish_function): Set TREE_NOTHROW later in the function.
-rw-r--r--gcc/cp/decl.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 87cb7a6..6e98ea3 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -17867,14 +17867,6 @@ finish_function (bool inline_p)
finish_fname_decls ();
- /* If this function can't throw any exceptions, remember that. */
- if (!processing_template_decl
- && !cp_function_chain->can_throw
- && !flag_non_call_exceptions
- && !decl_replaceable_p (fndecl,
- opt_for_fn (fndecl, flag_semantic_interposition)))
- TREE_NOTHROW (fndecl) = 1;
-
/* This must come after expand_function_end because cleanups might
have declarations (from inline functions) that need to go into
this function's blocks. */
@@ -18099,6 +18091,14 @@ finish_function (bool inline_p)
&& !DECL_OMP_DECLARE_REDUCTION_P (fndecl))
cp_genericize (fndecl);
+ /* If this function can't throw any exceptions, remember that. */
+ if (!processing_template_decl
+ && !cp_function_chain->can_throw
+ && !flag_non_call_exceptions
+ && !decl_replaceable_p (fndecl,
+ opt_for_fn (fndecl, flag_semantic_interposition)))
+ TREE_NOTHROW (fndecl) = 1;
+
/* Emit the resumer and destroyer functions now, providing that we have
not encountered some fatal error. */
if (coro_emit_helpers)