[Bug c++/59813] tail-call elimination didn't fire for left-shift of char to cout

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 9 18:13:00 GMT 2019


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

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 46332
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46332&action=edit
gcc10-pr59813-aarch64.patch

Untested fix.  The problem is that after adding sp addition back to the
caller's sp in the sibcall epilogue the aarch64 epilogue appends add sp, sp, x4
instruction, which adds a value of a random register to stack pointer (in this
case 1) and so the tail called function SIGBUSes.
That addition must be done only in the eh epilogue (aarch64 seems to have only
!for_sibcall and for_sibcall style epilogues, so one has to hope that a
function with __builtin_eh_return doesn't have more than one normal epilogue,
i.e. that they are all merged together).


More information about the Gcc-bugs mailing list