This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Exception Specifications & code quality


> I can't see how __tfc calls new (single stepping through the debugger
> doesn't get there).

__tfc is implemented in gcc/cp/tinfo2.cc, as

BUILTIN (c);

However, I was mistaken that the call to new might throw bad_alloc: It
is a placement new (on BSS memory), which doesn't fail.

> I think the reason the exception unwind blocks are there is because
> __cp_eh_info, __tfc do not have throw specifications -- they can't for
> obvious reasons. Unfortunately this means the compiler naturally assumes
> they can throw. What is really needed is a mechanism to allow the
> exception specification on the function, but inhibit the compiler
> emitting the check that the right tings are thrown for these.

I guess this is not so difficult to implement. These are builtin
functions, and their declarations are synthesized (sp?) rather than
parsed. It should be easy to put empty throw specs into the process.

> My original observation that checking a function body for uncaught
> exceptions and compile time matching this with the exception spec
> would also solve the problem, provided __cp_eh_info et al were
> compiled with optimization on.

Certainly.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]