[PATCH] (RFA tree-tailcall) PR c++/82081 - tail call optimization breaks noexcept

Jakub Jelinek jakub@redhat.com
Fri Apr 26 15:18:00 GMT 2019


On Fri, Apr 12, 2019 at 05:24:26PM -0400, Jason Merrill wrote:
> 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.
> 
> Tested x86_64-pc-linux-gnu.  OK for trunk or hold for GCC 10?  This isn't a
> regression, but it is a straightforward fix for a wrong-code bug.
> 
> 	* tree-tailcall.c (find_tail_calls): Don't turn a call from a
> 	nothrow function to a might-throw function into a tail call.

Ok for trunk (i.e. GCC 10) and we can backport later to 9.2 if it works fine
on the trunk.

	Jakub



More information about the Gcc-patches mailing list