This is the mail archive of the
mailing list for the GCC project.
use of exceptions in GCC
- From: Martin Sebor <msebor at gmail dot com>
- To: GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Wed, 16 Nov 2016 13:48:41 -0700
- Subject: use of exceptions in GCC
- Authentication-results: sourceware.org; auth=none
GCC is built with -fno-exceptions. I assume that's mainly to avoid
having to catch and handle exceptions in what was originally C code.
I also assume that also means that there's a policy or convention in
place against throwing exceptions in GCC or making use of constructs
that might throw (such as the non-placement new expressions).
By coincidence, bootstrapping my patch for bugs 77531 and 78284
exposed a few uses of the non-placement array new expression in
dominance.c (in dom_info::dom_init) that may throw an exception(*).
I'm wondering if those calls should be changed to avoid exceptions.
I'm also curious if there really is a policy/convention for dealing
with exceptions in GCC, what it actually is/says.
[*] My patch exposed these because when -fno-exceptions is used
(and coincidentally also in C++ 98 mode) GCC emits conditional calls
to operator new(SIZE_MAX) when the size computation that multiplies
the number of elements by the element size exceeds SIZE_MAX. The
-Walloc-size-larger-than warning flags for attempting to allocate
more storage than the size of the biggest object, or SIZE_MAX / 2.