[Bug c++/82081] Tail call optimisation of noexcept function leads to exception allowed through
jason at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 19 11:54:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82081
--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jul 19 11:53:41 2019
New Revision: 273601
URL: https://gcc.gnu.org/viewcvs?rev=273601&root=gcc&view=rev
Log:
PR c++/82081 - tail call optimization breaks noexcept
If a noexcept function calls a function that might throw, doing the tail
call optimization means that an exception thrown in the called function
will propagate out, breaking the noexcept specification. So we need to
prevent the optimization in that case.
* tree-tailcall.c (find_tail_calls): Don't turn a call from a
nothrow function to a might-throw function into a tail call.
Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/tree-ssa/tail-call-1.C
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/tree-tailcall.c
More information about the Gcc-bugs
mailing list