Re: [PATCH, i386]: Fix PR target/48723
What is wrong? x86-64 has 128byte redzone. Nothing wrong, just strange. ISTM that it doesn't serve any useful purpose. And I'm not sure that the rest of the code in ix86_expand_prologue is really prepared for a negative size either. -- Eric Botcazou
Re: [PATCH, i386]: Fix PR target/48723
On Saturday 23 April 2011 09:35:38 Uros Bizjak wrote: Index: i386.c === --- i386.c(revision 172866) +++ i386.c(working copy) @@ -10149,7 +10149,7 @@ ix86_adjust_stack_and_probe (const HOST_ /* Even if the stack pointer isn't the CFA register, we need to correctly describe the adjustments made to it, in particular differentiate the frame-related ones from the frame-unrelated ones. */ - if (size 0) + if (size != 0) { rtx expr = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2)); XVECEXP (expr, 0, 0) Probing for a negative size doesn't make much sense; we shouldn't be there if the size to allocate is negative. Is that really intended? The code without stack checking is: pushq %rbp .LCFI0: movq%rsp, %rbp .LCFI1: andq$-32, %rsp addq$16, %rsp which looks weird. If this is nevertheless correct, then the fix for the problem is attached. Tested on x86_64-suse-linux. PR target/48723 * config/i386/i386.c (ix86_expand_prologue): Do not probe the stack for -fstack-check if the size to allocate is negative. -- Eric Botcazou Index: config/i386/i386.c === --- config/i386/i386.c (revision 173209) +++ config/i386/i386.c (working copy) @@ -10619,8 +10619,8 @@ ix86_expand_prologue (void) } /* The stack has already been decremented by the instruction calling us - so we need to probe unconditionally to preserve the protection area. */ - if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK) + so probe if the size is non-negative to preserve the protection area. */ + if (allocate = 0 flag_stack_check == STATIC_BUILTIN_STACK_CHECK) { /* We expect the registers to be saved when probes are used. */ gcc_assert (int_registers_saved);
Re: [PATCH, i386]: Fix PR target/48723
On Sat, Apr 30, 2011 at 1:55 PM, Eric Botcazou ebotca...@adacore.com wrote: On Saturday 23 April 2011 09:35:38 Uros Bizjak wrote: Index: i386.c === --- i386.c (revision 172866) +++ i386.c (working copy) @@ -10149,7 +10149,7 @@ ix86_adjust_stack_and_probe (const HOST_ /* Even if the stack pointer isn't the CFA register, we need to correctly describe the adjustments made to it, in particular differentiate the frame-related ones from the frame-unrelated ones. */ - if (size 0) + if (size != 0) { rtx expr = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2)); XVECEXP (expr, 0, 0) Probing for a negative size doesn't make much sense; we shouldn't be there if the size to allocate is negative. Is that really intended? The code without stack checking is: pushq %rbp .LCFI0: movq %rsp, %rbp .LCFI1: andq $-32, %rsp addq $16, %rsp which looks weird. If this is nevertheless correct, then the fix for the problem is attached. Tested on x86_64-suse-linux. This code aligns stack to 32byte for AVX. -- H.J.
Re: [PATCH, i386]: Fix PR target/48723
This code aligns stack to 32byte for AVX. Right, the strange line is the next one. -- Eric Botcazou
Re: [PATCH, i386]: Fix PR target/48723
On Sat, Apr 30, 2011 at 2:56 PM, Eric Botcazou ebotca...@adacore.com wrote: This code aligns stack to 32byte for AVX. Right, the strange line is the next one. What is wrong? x86-64 has 128byte redzone. -- H.J.
Re: [PATCH, i386]: Fix PR target/48723
On Fri, Apr 22, 2011 at 11:38 PM, Eric Botcazou ebotca...@adacore.com wrote: Attached one-liner fixes PR target/48723, ICE in ix86_expand_prologue() with -fstack-check + function returning struct, on corei7-avx. The problem was, that we forgot to update accounting info when ix86_adjust_stack_and_probe adjusted stack pointer (in this particular case, m-fs.sp_offset was set by stack realignment code for AVX 32byte stack alignment. Take a look at line 10165 of config/i386/i386.c. Index: i386.c === --- i386.c (revision 172866) +++ i386.c (working copy) @@ -10149,7 +10149,7 @@ ix86_adjust_stack_and_probe (const HOST_ /* Even if the stack pointer isn't the CFA register, we need to correctly describe the adjustments made to it, in particular differentiate the frame-related ones from the frame-unrelated ones. */ - if (size 0) + if (size != 0) { rtx expr = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2)); XVECEXP (expr, 0, 0) Uros.
Re: [PATCH, i386]: Fix PR target/48723
On Fri, Apr 22, 2011 at 11:38 PM, Eric Botcazou ebotca...@adacore.com wrote: Attached one-liner fixes PR target/48723, ICE in ix86_expand_prologue() with -fstack-check + function returning struct, on corei7-avx. The problem was, that we forgot to update accounting info when ix86_adjust_stack_and_probe adjusted stack pointer (in this particular case, m-fs.sp_offset was set by stack realignment code for AVX 32byte stack alignment. Take a look at line 10165 of config/i386/i386.c. I have reverted my original patch. Uros.