diff mbox

[i386] : FIX PR 45206, ICE on __builtin_eh_return at -Os

Message ID AANLkTi=JNuXLQw_tZ3S3v-qkBF_+ka-7O4zFAFXoxLj1@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Sept. 7, 2010, 2:29 p.m. UTC
Hello!

Currently, the attached testcase fails with:

pr45206.c: In function ‘_Unwind_RaiseException’:
pr45206.c:12:1: internal compiler error: in ix86_expand_epilogue, at
config/i386/i386.c:10206
Please submit a full bug report,

The problem is, that after stack pointer fixup code for eh_return
epilogue was emitted, we forgot to mark SP as valid.

2010-09-07  Uros Bizjak  <ubizjak@gmail.com>

	PR target/45206
	* config/i386/i386.c (ix86_expand_epilogue): Mark SP as valid after
	eh_return fixup sequence.

testsuite/ChangeLog:

2010-09-07  Uros Bizjak  <ubizjak@gmail.com>

	PR target/45206
	* gcc.target/i386/pr45206.c: New test.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
{,-m32}. Additionally, patched gcc generates exactly the same code as
gcc-4.4.4 for attached testcase.

OK for mainline?

Uros.

Comments

Richard Henderson Sept. 7, 2010, 3 p.m. UTC | #1
On 09/07/2010 07:29 AM, Uros Bizjak wrote:
> 	PR target/45206
> 	* config/i386/i386.c (ix86_expand_epilogue): Mark SP as valid after
> 	eh_return fixup sequence.

Ok.  Thanks.


r~
diff mbox

Patch

Index: testsuite/gcc.target/i386/pr45206.c
===================================================================
--- testsuite/gcc.target/i386/pr45206.c	(revision 0)
+++ testsuite/gcc.target/i386/pr45206.c	(revision 0)
@@ -0,0 +1,16 @@ 
+/* { dg-do compile } */
+/* { dg-options "-Os -fno-omit-frame-pointer" } */
+
+struct _Unwind_Context { void *ra; };
+
+long uw_install_context_1 (struct _Unwind_Context *, struct _Unwind_Context *);
+
+void _Unwind_RaiseException(void)
+{
+  struct _Unwind_Context this_context, cur_context;
+  long offset = uw_install_context_1 (&this_context, &cur_context);
+  void *handler = __builtin_frob_return_addr ((&cur_context)->ra);
+
+  __builtin_eh_return (offset, handler);
+}
+
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 163943)
+++ config/i386/i386.c	(working copy)
@@ -10118,6 +10118,7 @@  ix86_expand_epilogue (int style)
 		}
 	    }
 	  m->fs.sp_offset = UNITS_PER_WORD;
+	  m->fs.sp_valid = true;
 	}
     }
   else