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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Mon Apr 29 17:27:13 2019
New Revision: 270656

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

Reply via email to