area, see the SEH code in config/i386/winnt.c for the rationale. */
frame->hard_frame_pointer_offset = frame->sse_reg_save_offset;
- /* If we can leave the frame pointer where it is, do so. Also, return
+ /* If we can leave the frame pointer where it is, do so; however return
the establisher frame for __builtin_frame_address (0) or else if the
- frame overflows the SEH maximum frame size. */
+ frame overflows the SEH maximum frame size.
+
+ Note that the value returned by __builtin_frame_address (0) is quite
+ constrained, because setjmp is piggybacked on the SEH machinery with
+ recent versions of MinGW:
+
+ # elif defined(__SEH__)
+ # if defined(__aarch64__) || defined(_ARM64_)
+ # define setjmp(BUF) _setjmp((BUF), __builtin_sponentry())
+ # elif (__MINGW_GCC_VERSION < 40702)
+ # define setjmp(BUF) _setjmp((BUF), mingw_getsp())
+ # else
+ # define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
+ # endif
+
+ and the second argument passed to _setjmp, if not null, is forwarded
+ to the TargetFrame parameter of RtlUnwindEx by longjmp (after it has
+ built an ExceptionRecord on the fly describing the setjmp buffer). */
const HOST_WIDE_INT diff
= frame->stack_pointer_offset - frame->hard_frame_pointer_offset;
- if (diff <= 255)
+ if (diff <= 255 && !crtl->accesses_prior_frames)
{
/* The resulting diff will be a multiple of 16 lower than 255,
i.e. at most 240 as required by the unwind data structure. */