[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 Bug 79793 depends on bug 81570, which changed state. Bug 81570 Summary: create_pseudo_cfg assumes that INCOMING_FRAME_SP_OFFSET is a constant https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81570 What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #21 from Aldy Hernandez --- Author: aldyh Date: Wed Sep 13 16:05:20 2017 New Revision: 252181 URL: https://gcc.gnu.org/viewcvs?rev=252181=gcc=rev Log: i386: Update INCOMING_FRAME_SP_OFFSET for exception handler Since there is an extra error code passed to the exception handler, INCOMING_FRAME_SP_OFFSET is return address plus error code for the exception handler. This patch updates INCOMING_FRAME_SP_OFFSET to the correct value for the exception handler. This patch exposed a bug in DWARF stack frame CFI generation, which assumes that INCOMING_FRAME_SP_OFFSET is the same for all functions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81570 It sets and caches the incoming stack frame offset with the same INCOMING_FRAME_SP_OFFSET for all functions. When there are both exception handler and normal function in the same input, the wrong incoming stack frame offset is used for exception handler or normal function, which leads to FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 error == 0x12345670 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->ip == 0x12345671 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->cs == 0x12345672 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->flags == 0x12345673 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->sp == 0x12345674 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->ss == 0x12345675 With the patch for PR 81570: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01851.html applied, there are no regressions on i686 and x86-64. gcc/ PR target/79793 * config/i386/i386.c (ix86_function_arg): Update arguments for exception handler. (ix86_compute_frame_layout): Set the initial stack offset to INCOMING_FRAME_SP_OFFSET. Update red-zone offset with INCOMING_FRAME_SP_OFFSET. (ix86_expand_epilogue): Don't pop the 'ERROR_CODE' off the stack before exception handler returns. * config/i386/i386.h (INCOMING_FRAME_SP_OFFSET): Add the the 'ERROR_CODE' for exception handler. gcc/testsuite/ PR target/79793 * gcc.dg/guality/pr68037-1.c: Update gdb breakpoints. * gcc.target/i386/interrupt-5.c (interrupt_frame): New struct. (foo): Check the builtin return address against the return address in interrupt frame. * gcc.target/i386/pr79793-1.c: New test. * gcc.target/i386/pr79793-2.c: Likewise. Added: branches/range-gen2/gcc/testsuite/gcc.target/i386/pr79793-1.c branches/range-gen2/gcc/testsuite/gcc.target/i386/pr79793-2.c Modified: branches/range-gen2/gcc/ChangeLog branches/range-gen2/gcc/config/i386/i386.c branches/range-gen2/gcc/config/i386/i386.h branches/range-gen2/gcc/testsuite/ChangeLog branches/range-gen2/gcc/testsuite/gcc.dg/guality/pr68037-1.c branches/range-gen2/gcc/testsuite/gcc.target/i386/interrupt-5.c
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 H.J. Lu changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #20 from H.J. Lu --- Fixed for GCC 8.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #19 from hjl at gcc dot gnu.org --- Author: hjl Date: Sun Jul 30 14:10:32 2017 New Revision: 250721 URL: https://gcc.gnu.org/viewcvs?rev=250721=gcc=rev Log: i386: Update INCOMING_FRAME_SP_OFFSET for exception handler Since there is an extra error code passed to the exception handler, INCOMING_FRAME_SP_OFFSET is return address plus error code for the exception handler. This patch updates INCOMING_FRAME_SP_OFFSET to the correct value for the exception handler. This patch exposed a bug in DWARF stack frame CFI generation, which assumes that INCOMING_FRAME_SP_OFFSET is the same for all functions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81570 It sets and caches the incoming stack frame offset with the same INCOMING_FRAME_SP_OFFSET for all functions. When there are both exception handler and normal function in the same input, the wrong incoming stack frame offset is used for exception handler or normal function, which leads to FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 error == 0x12345670 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->ip == 0x12345671 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->cs == 0x12345672 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->flags == 0x12345673 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->sp == 0x12345674 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->ss == 0x12345675 With the patch for PR 81570: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg01851.html applied, there are no regressions on i686 and x86-64. gcc/ PR target/79793 * config/i386/i386.c (ix86_function_arg): Update arguments for exception handler. (ix86_compute_frame_layout): Set the initial stack offset to INCOMING_FRAME_SP_OFFSET. Update red-zone offset with INCOMING_FRAME_SP_OFFSET. (ix86_expand_epilogue): Don't pop the 'ERROR_CODE' off the stack before exception handler returns. * config/i386/i386.h (INCOMING_FRAME_SP_OFFSET): Add the the 'ERROR_CODE' for exception handler. gcc/testsuite/ PR target/79793 * gcc.dg/guality/pr68037-1.c: Update gdb breakpoints. * gcc.target/i386/interrupt-5.c (interrupt_frame): New struct. (foo): Check the builtin return address against the return address in interrupt frame. * gcc.target/i386/pr79793-1.c: New test. * gcc.target/i386/pr79793-2.c: Likewise. Added: trunk/gcc/testsuite/gcc.target/i386/pr79793-1.c trunk/gcc/testsuite/gcc.target/i386/pr79793-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/config/i386/i386.h trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/guality/pr68037-1.c trunk/gcc/testsuite/gcc.target/i386/interrupt-5.c
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 H.J. Lu changed: What|Removed |Added Status|REOPENED|NEW Depends on||81570 --- Comment #18 from H.J. Lu --- (In reply to H.J. Lu from comment #17) > > We didn't lose the info. The problem is that create_pseudo_cfg assumes > INCOMING_FRAME_SP_OFFSET is a constant. I opened PR 81570. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81570 [Bug 81570] create_pseudo_cfg assumes that INCOMING_FRAME_SP_OFFSET is a constant
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #17 from H.J. Lu --- (In reply to H.J. Lu from comment #16) > The problem is in create_cie_data: > > /* On entry, the Canonical Frame Address is at SP. */ > memset (, 0, sizeof (loc)); > loc.reg = dw_stack_pointer_regnum; > loc.offset = INCOMING_FRAME_SP_OFFSET; > def_cfa_1 (); > > We lost the function type info with LTO. We didn't lose the info. The problem is that create_pseudo_cfg assumes INCOMING_FRAME_SP_OFFSET is a constant.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #16 from H.J. Lu --- The problem is in create_cie_data: /* On entry, the Canonical Frame Address is at SP. */ memset (, 0, sizeof (loc)); loc.reg = dw_stack_pointer_regnum; loc.offset = INCOMING_FRAME_SP_OFFSET; def_cfa_1 (); We lost the function type info with LTO.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 H.J. Lu changed: What|Removed |Added Attachment #41834|0 |1 is obsolete|| --- Comment #15 from H.J. Lu --- Created attachment 41839 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41839=edit A patch -g -O2 -flto generates: Dump of assembler code for function fn: 0x00400550 <+0>: push %rdi 0x00400551 <+1>: sub$0x8,%rsp 0x00400555 <+5>: cmpq $0x12345670,0x10(%rsp) 0x0040055e <+14>:jne0x400430 => 0x00400564 <+20>:cmpq $0x12345671,0x18(%rsp) with debug info: 0084 0018 0058 FDE cie=0030 pc=00400550..004005b7 DW_CFA_advance_loc: 1 to 00400551 DW_CFA_def_cfa_offset: 16 DW_CFA_offset: r5 (rdi) at cfa-16 DW_CFA_advance_loc: 4 to 00400555 DW_CFA_def_cfa_offset: 24 DW_CFA_nop DW_CFA_nop DW_CFA_nop -g -O2 generates: 0x00400550 <+0>: push %rdi 0x00400551 <+1>: sub$0x8,%rsp 0x00400555 <+5>: cmpq $0x12345670,0x10(%rsp) 0x0040055e <+14>:jne0x400430 0x00400564 <+20>:cmpq $0x12345671,0x18(%rsp) with debug info: 0070 0018 0044 FDE cie=0030 pc=00400550..004005b7 DW_CFA_advance_loc: 1 to 00400551 DW_CFA_def_cfa_offset: 24 DW_CFA_offset: r5 (rdi) at cfa-24 DW_CFA_advance_loc: 4 to 00400555 DW_CFA_def_cfa_offset: 32 DW_CFA_nop DW_CFA_nop DW_CFA_nop Somehow -flto -O2 generates the incorrect debug info.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 H.J. Lu changed: What|Removed |Added Attachment #41830|0 |1 is obsolete|| --- Comment #14 from H.J. Lu --- Created attachment 41834 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41834=edit An untested patch
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 H.J. Lu changed: What|Removed |Added Attachment #41826|0 |1 is obsolete|| Attachment #41828|0 |1 is obsolete|| --- Comment #13 from H.J. Lu --- Created attachment 41830 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41830=edit An untested patch The only interrupt failures are FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 error == 0x12345670 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->ip == 0x12345671 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->cs == 0x12345672 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->flags == 0x12345673 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->sp == 0x12345674 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->ss == 0x12345675
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #12 from H.J. Lu --- Created attachment 41828 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41828=edit An updated patch Update gcc.dg/guality/pr68037-1.c. I got FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 error == 0x12345670 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->ip == 0x12345671 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->cs == 0x12345672 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->flags == 0x12345673 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->sp == 0x12345674 FAIL: gcc.dg/guality/pr68037-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 33 frame->ss == 0x12345675 and Running target unix/-m32 Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using /export/gnu/import/git/sources/gcc/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.target/i386/i386.exp ... FAIL: gcc.target/i386/interrupt-12.c scan-assembler-times movl[\\t ]*-4\\(%ebp\\),[\\t ]*%eax 1 FAIL: gcc.target/i386/interrupt-13.c scan-assembler-times movl[\\t ]*-4\\(%ebp\\),[\\t ]*%eax 1 FAIL: gcc.target/i386/interrupt-15.c scan-assembler-times movl[\\t ]*-4\\(%ebp\\),[\\t ]*%eax 2 === gcc Summary for unix/-m32 === # of expected passes211 # of unexpected failures3 # of unsupported tests 2
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #11 from H.J. Lu --- (In reply to Uroš Bizjak from comment #9) > Created attachment 41826 [details] > Adjust INCOMING_FRAME_SP_OFFSET for TYPE_EXCEPTION functions > > How about something like attached patch? The patch adjusts > INCOMING_FRAME_SP_OFFSET of an exception handler to 2 * UNITS_PER_WORD. > > The resulting code reads: > > .cfi_startproc > subq$392, %rsp > .cfi_def_cfa_offset 400 > fxsave64-120(%rsp) > addq$400, %rsp > .cfi_def_cfa_offset 0 > iretq > .cfi_endproc > > Patch is otherwise untested. Probably, function argument parsing code has to > be adjusted as well. I'm also not sure if all .cfi directives are correct. Our patches are very similar. Mine passed most of interrupt tests.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #10 from H.J. Lu --- Created attachment 41827 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41827=edit An untested patch
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #9 from Uroš Bizjak --- Created attachment 41826 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41826=edit Adjust INCOMING_FRAME_SP_OFFSET for TYPE_EXCEPTION functions How about something like attached patch? The patch adjusts INCOMING_FRAME_SP_OFFSET of an exception handler to 2 * UNITS_PER_WORD. The resulting code reads: .cfi_startproc subq$392, %rsp .cfi_def_cfa_offset 400 fxsave64-120(%rsp) addq$400, %rsp .cfi_def_cfa_offset 0 iretq .cfi_endproc Patch is otherwise untested. Probably, function argument parsing code has to be adjusted as well. I'm also not sure if all .cfi directives are correct.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #8 from H.J. Lu --- clang 5.0 handles stack alignment correctly: [hjl@gnu-skl-1 pr79793]$ cat x.c typedef unsigned int uword_t __attribute__ ((mode (__word__))); __attribute__((interrupt)) void fn (void *frame) { char fxsave_region [512] __attribute__((aligned(16))); __builtin_ia32_fxsave (fxsave_region); } [hjl@gnu-skl-1 pr79793]$ cat y.c typedef unsigned int uword_t __attribute__ ((mode (__word__))); __attribute__((interrupt)) void fn (void *frame, uword_t error) { char fxsave_region [512] __attribute__((aligned(16))); __builtin_ia32_fxsave (fxsave_region); } [hjl@gnu-skl-1 pr79793]$ make /export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -O2 -mgeneral-regs-only -S -o y.s y.c clang-5.0: warning: argument unused during compilation: '-mgeneral-regs-only' [-Wunused-command-line-argument] [hjl@gnu-skl-1 pr79793]$ cat x.s .text .file "x.c" .globl fn # -- Begin function fn .p2align4, 0x90 .type fn,@function fn: # @fn .cfi_startproc # BB#0: # %entry subq$392, %rsp # imm = 0x188 .Lcfi0: .cfi_def_cfa_offset 400 cld fxsave -128(%rsp) addq$392, %rsp # imm = 0x188 iretq .Lfunc_end0: .size fn, .Lfunc_end0-fn .cfi_endproc # -- End function .ident "clang version 5.0.0 (http://llvm.org/git/clang.git f53edbb006df3bc205bf38008d96de510b2a) (http://llvm.org/git/llvm.git 9889fe2290766430b99a2d4fadbc5ba92f8004b6)" .section".note.GNU-stack","",@progbits [hjl@gnu-skl-1 pr79793]$ cat y.s .text .file "y.c" .globl fn # -- Begin function fn .p2align4, 0x90 .type fn,@function fn: # @fn .cfi_startproc # BB#0: # %entry pushq %rax subq$400, %rsp # imm = 0x190 .Lcfi0: .cfi_def_cfa_offset 408 cld fxsave -120(%rsp) addq$400, %rsp # imm = 0x190 addq$16, %rsp iretq .Lfunc_end0: .size fn, .Lfunc_end0-fn .cfi_endproc # -- End function .ident "clang version 5.0.0 (http://llvm.org/git/clang.git f53edbb006df3bc205bf38008d96de510b2a) (http://llvm.org/git/llvm.git 9889fe2290766430b99a2d4fadbc5ba92f8004b6)" .section".note.GNU-stack","",@progbits [hjl@gnu-skl-1 pr79793]$
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #7 from H.J. Lu --- (In reply to H.J. Lu from comment #5) > In 64-bit mode, stack is 16-byte aligned when entering handler. But if > there is error code > > SS > RSP > FLAGS > CS > RIP > Error Code > > the stack alignment is off by 8 bytes. That is %rsp + 8 isn't multiple > of 16 at the start of handler. A testcase: [hjl@gnu-skl-1 pr79793]$ cat y.c #include typedef unsigned int uword_t __attribute__ ((mode (__word__))); struct interrupt_frame { uword_t ip; uword_t cs; uword_t flags; uword_t sp; uword_t ss; }; __attribute__((interrupt)) void fn (struct interrupt_frame *frame, uword_t error) { char fxsave_region [512] __attribute__((aligned(16))); _fxsave64 (fxsave_region); } [hjl@gnu-skl-1 pr79793]$ make y.s /export/build/gnu/gcc-x32-7/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-x32-7/build-x86_64-linux/gcc/ -O2 -mgeneral-regs-only -S -o y.s y.c [hjl@gnu-skl-1 pr79793]$ cat y.s .file "y.c" .text .p2align 4,,15 .globl fn .type fn, @function fn: .LFB4: .cfi_startproc subq$400, %rsp .cfi_def_cfa_offset 408 fxsave64-120(%rsp) addq$408, %rsp iretq .cfi_endproc .LFE4: .size fn, .-fn .ident "GCC: (GNU) 7.1.1 20170724" .section.note.GNU-stack,"",@progbits [hjl@gnu-skl-1 pr79793]$ -120(%rsp) isn't aligned at 16 bytes. For [hjl@gnu-skl-1 pr79793]$ cat x.c #include typedef unsigned int uword_t __attribute__ ((mode (__word__))); struct interrupt_frame { uword_t ip; uword_t cs; uword_t flags; uword_t sp; uword_t ss; }; __attribute__((interrupt)) void fn (struct interrupt_frame *frame) { char fxsave_region [512] __attribute__((aligned(16))); _fxsave64 (fxsave_region); } [hjl@gnu-skl-1 pr79793]$ make x.s /export/build/gnu/gcc-x32-7/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-x32-7/build-x86_64-linux/gcc/ -O2 -mgeneral-regs-only -S -o x.s x.c [hjl@gnu-skl-1 pr79793]$ cat x.s .file "x.c" .text .p2align 4,,15 .globl fn .type fn, @function fn: .LFB4: .cfi_startproc subq$400, %rsp .cfi_def_cfa_offset 408 fxsave64-120(%rsp) addq$400, %rsp .cfi_def_cfa_offset 8 iretq .cfi_endproc .LFE4: .size fn, .-fn .ident "GCC: (GNU) 7.1.1 20170724" .section.note.GNU-stack,"",@progbits [hjl@gnu-skl-1 pr79793]$ -120(%rsp) is aligned at 16 bytes.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 Jakub Jelinek changed: What|Removed |Added Target Milestone|7.0 |7.2 --- Comment #6 from Jakub Jelinek --- GCC 7.1 has been released.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 H.J. Lu changed: What|Removed |Added Status|RESOLVED|REOPENED Last reconfirmed||2017-03-13 Resolution|FIXED |--- Ever confirmed|0 |1 --- Comment #5 from H.J. Lu --- In 64-bit mode, stack is 16-byte aligned when entering handler. But if there is error code SS RSP FLAGS CS RIP Error Code the stack alignment is off by 8 bytes. That is %rsp + 8 isn't multiple of 16 at the start of handler.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 H.J. Lu changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Target Milestone|--- |7.0 --- Comment #4 from H.J. Lu --- Fixed for GCC 7.
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #3 from hjl at gcc dot gnu.org --- Author: hjl Date: Mon Mar 6 16:08:59 2017 New Revision: 245926 URL: https://gcc.gnu.org/viewcvs?rev=245926=gcc=rev Log: Set incoming stack boundary to 128 for 64-bit targets For 64-bit targets, the incoming stack of interrupt handler is aligned to 16 bytes. Update ix86_minimum_incoming_stack_boundary to set the incoming stack boundary of interrupt handler to 128 for 64-bit targets. gcc/ 2017-03-06 Julia KovalPR target/79793 * config/i386/i386.c (ix86_minimum_incoming_stack_boundary): Set incoming stack boundary to 128 for 64-bit targets. gcc/testsuite/ 2017-03-06 Julia Koval PR target/79793 * gcc.target/i386/interrupt-12.c: Update scan-assembler-times directives. * gcc.target/i386/interrupt-13.c: Ditto. * gcc.target/i386/interrupt-14.c: Ditto. * gcc.target/i386/interrupt-15.c: Ditto. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.target/i386/interrupt-12.c trunk/gcc/testsuite/gcc.target/i386/interrupt-13.c trunk/gcc/testsuite/gcc.target/i386/interrupt-14.c trunk/gcc/testsuite/gcc.target/i386/interrupt-15.c
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #2 from Yulia Koval --- Patch posted at https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00178.html
[Bug target/79793] Incorrect stack alignment for interrupt handler in 64-bit
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79793 --- Comment #1 from Richard Biener --- Well, not "incorrect" but too conservative.