https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82081

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jul 19 08:52:41 2019
New Revision: 273594

URL: https://gcc.gnu.org/viewcvs?rev=273594&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-9-branch/gcc/testsuite/g++.dg/tree-ssa/tail-call-1.C
Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/tree-tailcall.c

Reply via email to