diff mbox

[i386] : Fix PR target/48723

Message ID BANLkTikcR6OLzK5FvdkKZvqepBYF7JDTSQ@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak April 22, 2011, 6:37 p.m. UTC
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  <ubizjak@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  <ubizjak@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.

Comments

Eric Botcazou April 22, 2011, 9:38 p.m. UTC | #1
> 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.
Uros Bizjak April 23, 2011, 7:47 a.m. UTC | #2
On Fri, Apr 22, 2011 at 11:38 PM, Eric Botcazou <ebotcazou@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.
diff mbox

Patch

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);
+}