]> gcc.gnu.org Git - gcc.git/commit
c++/contracts: ICE in C++ Contracts with '-fno-exceptions' [PR 110159]
authorNina Ranns <dinka.ranns@gmail.com>
Thu, 11 Jul 2024 16:47:34 +0000 (17:47 +0100)
committerJason Merrill <jason@redhat.com>
Tue, 16 Jul 2024 18:51:52 +0000 (14:51 -0400)
commit40a990c8b512fd25bd7d7b45aa509e1880d77209
treecdb8f98be93407ace4baf5664ef77259ad43a90d
parenta3d1469c7c7e152fa7a5dbc95dbc6d1f3792bbd8
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>
gcc/cp/cp-tree.h
gcc/cp/decl.cc
gcc/cp/except.cc
gcc/testsuite/g++.dg/contracts/pr110159.C [new file with mode: 0644]
This page took 0.065845 seconds and 6 git commands to generate.