Skip to content
Snippets Groups Projects
Commit e8d1ca7d authored by Eric Botcazou's avatar Eric Botcazou
Browse files

Fix PR target/100402

This is a regression for 64-bit Windows present from mainline down to the 9
branch and introduced by the fix for PR target/99234.  Again SEH, but with
a twist related to the way MinGW implements setjmp/longjmp, which turns out
to be piggybacked on SEH with recent versions of MinGW, i.e. the longjmp
performs a bona-fide unwinding of the stack, because it calls RtlUnwindEx
with the second argument initially passed to setjmp, which is the result of
__builtin_frame_address (0) in the MinGW header file:

  define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))

This means that we directly expose the frame pointer to the SEH machinery
here (unlike with regular exception handling where we use an intermediate
CFA) and thus that we cannot do whatever we want with it.  The old code
would leave it unaligned, i.e. not multiple of 16, whereas the new code
aligns it, but this breaks for some reason; at least it appears that a
.seh_setframe directive with 0 as second argument always works, so the
fix aligns it this way.

gcc/
	PR target/100402
	* config/i386/i386.c (ix86_compute_frame_layout): For a SEH target,
	always return the establisher frame for __builtin_frame_address (0).
gcc/testsuite/
	* gcc.c-torture/execute/20210505-1.c: New test.
parent a0b4e09a
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment