On Fri, May 10, 2019 at 01:46:07PM +0000, Wilco Dijkstra wrote:
> And looking at the generated code, emitting a tailcall for this case is 
> actually a
> de-optimization since the large eh_return epilog must be repeated for every
> tailcall.

On x86_64, the code is shorter with the tail call rather than without.

That said, here is actually tested workaround until targets are fixed.
Richard or Jeff, do we want this workaround?

I don't see why we would need extra testsuite coverage for this, given the
number of FAILs or bootstrap issues on targets that are broken.

2019-05-10  Jakub Jelinek  <ja...@redhat.com>

        PR c++/59813
        * unwind.inc (_Unwind_Resume_or_Rethrow): Add optimize attribute
        to temporarily avoid tail calls in the function.

--- libgcc/unwind.inc.jj        2019-01-01 12:38:17.345987416 +0100
+++ libgcc/unwind.inc   2019-05-10 17:10:32.436329516 +0200
@@ -252,6 +252,7 @@ _Unwind_Resume (struct _Unwind_Exception
    a normal exception that was handled.  */
 
 _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE
+__attribute__((optimize ("no-optimize-sibling-calls")))
 _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
 {
   struct _Unwind_Context this_context, cur_context;


        Jakub

Reply via email to