Hello! 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.
2011-04-22 Uros Bizjak <ubiz...@gmail.com> PR target/48723 * config/i386/i386.c (ix86_expand_prologue): Update m->fs.sp_offset after the call to ix86_adjust_stack_and_probe. testsuite/ChangeLog: 2011-04-22 Uros Bizjak <ubiz...@gmail.com> PR target/48723 * gcc.target/i386/pr48723.c: New test. Tested on x86_64-pc-linux-gnu {,-m32} AVX target. Patch was committed to mainline and 4.6 branch. Uros.
Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 172860) +++ config/i386/i386.c (working copy) @@ -10628,6 +10628,7 @@ ix86_expand_prologue (void) if (STACK_CHECK_MOVING_SP) { ix86_adjust_stack_and_probe (allocate); + m->fs.sp_offset += allocate; allocate = 0; } else Index: testsuite/gcc.target/i386/pr48723.c =================================================================== --- testsuite/gcc.target/i386/pr48723.c (revision 0) +++ testsuite/gcc.target/i386/pr48723.c (revision 0) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-fstack-check -mavx" } */ + +struct S0 +{ + int f0, f1, f2, f3; +} g_106; + +struct S0 +func_99 () +{ + return (g_106); +}