aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-tree.h
diff options
context:
space:
mode:
authorNina Ranns <dinka.ranns@gmail.com>2024-07-11 17:47:34 +0100
committerJason Merrill <jason@redhat.com>2024-07-16 14:51:52 -0400
commit40a990c8b512fd25bd7d7b45aa509e1880d77209 (patch)
treecdb8f98be93407ace4baf5664ef77259ad43a90d /gcc/cp/cp-tree.h
parenta3d1469c7c7e152fa7a5dbc95dbc6d1f3792bbd8 (diff)
downloadgcc-40a990c8b512fd25bd7d7b45aa509e1880d77209.zip
gcc-40a990c8b512fd25bd7d7b45aa509e1880d77209.tar.gz
gcc-40a990c8b512fd25bd7d7b45aa509e1880d77209.tar.bz2
c++/contracts: ICE in C++ Contracts with '-fno-exceptions' [PR 110159]
We currently only initialise terminate_fn if exceptions are enabled. However, contract handling requires terminate_fn when building the contract because a contract failure may result in std::terminate call regardless of whether the exceptions are enabled. Refactored init_exception_processing to extract the initialisation of terminate_fn. New function init_terminate_fn added that initialises terminate_fn if it hasn't already been initialised. Call to terminate_fn added in cxx_init_decl_processing if contracts are enabled. PR c++/110159 gcc/cp/ChangeLog: * cp-tree.h (init_terminate_fn): Declaration of a new function. * decl.cc (cxx_init_decl_processing): If contracts are enabled, call init_terminate_fn. * except.cc (init_exception_processing): Function refactored to call init_terminate_fn. (init_terminate_fn): Added new function that initializes terminate_fn if it hasn't already been initialised. gcc/testsuite/ChangeLog: * g++.dg/contracts/pr110159.C: New test. Signed-off-by: Nina Ranns <dinka.ranns@gmail.com>
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r--gcc/cp/cp-tree.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index c1a371bc..c6f1025 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -7194,6 +7194,7 @@ extern void qualified_name_lookup_error (tree, tree, tree,
location_t);
/* in except.cc */
+extern void init_terminate_fn (void);
extern void init_exception_processing (void);
extern tree expand_start_catch_block (tree);
extern void expand_end_catch_block (void);