PR c++/82081 - tail call optimization breaks noexcept
authorJason Merrill <jason@redhat.com>
Mon, 29 Apr 2019 17:27:13 +0000 (13:27 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 29 Apr 2019 17:27:13 +0000 (13:27 -0400)
commitd407e7f53b4a9c3f607b692d89b4ad7d87df5933
tree3c9963eb4dd5887df09070c5d7199822d305c7d4
parent348dd384c8f647ba56be21932d068d180be243e3
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.

From-SVN: r270656
gcc/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/tail-call-1.C [new file with mode: 0644]
gcc/tree-tailcall.c