[Bug target/84521] [8 Regression] aarch64: Frame-pointer corruption with __builtin_setjmp/__builtin_longjmp and -fomit-frame-pointer

wilco at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 22 20:02:00 GMT 2018


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

--- Comment #6 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)

> (completely untested) would require frame pointers for all setjmp calls, not
> just __builtin_setjmp.

That's the correct approach indeed, however aarch64_frame_pointer_required is
no longer used, this now needs to added to aarch64_layout_frame:

  /* Force a frame chain for EH returns so the return address is at FP+8.  */
  cfun->machine->frame.emit_frame_chain
    = frame_pointer_needed || crtl->calls_eh_return;

> BTW, does __builtin_return_address really work on aarch64 without frame
> pointers?  Various other targets require frame pointers when
> cfun->machine->access_prev_frame (i.e. when SETUP_FRAME_ADDRESSES () has
> been used).

It only supports returning the return address of the current function (and even
that is most likely a bug rather than useful). When level != 0 it always
returns 0.


More information about the Gcc-bugs mailing list