https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84066
--- Comment #6 from igor.v.tsimbalist at intel dot com --- (In reply to H.J. Lu from comment #5) > (In reply to igor.v.tsimbalist from comment #4) > > Created attachment 43280 [details] > > updated patch > > - mem = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0], > - 3 * GET_MODE_SIZE (Pmode))); > - reg_ssp = gen_reg_rtx (Pmode); > + mem = gen_rtx_MEM (word_mode, plus_constant (Pmode, operands[0], > + 3 * GET_MODE_SIZE (Pmode))); > > The first 3 fields are SP, FP and IP, which are in ptr_mode, not Pmode. ok. > /* Compute the numebr of frames to adjust. */ > + reg_adj = gen_rtx_SUBREG (Pmode, reg_ssp, 0); > > reg_ssp must be in word_mode, not in Pmode. reg_ssp is word_mode. It's reg_adj that is Pmode (it's increment to shadow stack). > Please show the assembly outputs of __builtin_setjmp and __builtin_longjmp > with the updated patch. A snippet for __builtin_longjmp for -mx32 movl $0, %eax rdsspq %rax subq buf+12(%rip), %rax je .L2 negl %eax shrl $2, %eax cmpl $255, %eax jbe .L3 .L4: incsspq %rax subl $255, %eax cmpl $255, %eax ja .L4 .L3: incsspq %rax .L2: Snippet for __builtin_setjmp for -mx32 movl %eax, buf(%rip) movl $.L8, buf+4(%rip) movl %esp, buf+8(%rip) movl $0, %eax rdsspq %rax movq %rax, buf+12(%rip)