: Fix PR45296, register long double ICE at -O2, -Os, -O3

Submitted by Uros Bizjak on Aug. 17, 2010, 7:27 a.m.

Details

Message ID AANLkTinsKsYpdXKBXoHmApqz+LG_YXuvHhvDjcUGwLat@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Aug. 17, 2010, 7:27 a.m.
Hello!

We should reject stack registers as global registers, otherwise stack
compensation code ICEs.

2010-08-17  Uros Bizjak  <ubizjak@gmail.com>

	PR target/45296
	* reginfo.c (globalize_reg): Reject stack registers.

testsuite/ChangeLog:

2010-08-17  Uros Bizjak  <ubizjak@gmail.com>

	PR target/45296
	* gcc.target/i386/pr45296.c: New test.

Tested on x86_64-pc-linux-gnu {,-m32}. OK for mainline and release branches?

Uros.

Comments

Richard Guenther Aug. 17, 2010, 9:43 a.m.
On Tue, Aug 17, 2010 at 9:27 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> We should reject stack registers as global registers, otherwise stack
> compensation code ICEs.
>
> 2010-08-17  Uros Bizjak  <ubizjak@gmail.com>
>
>        PR target/45296
>        * reginfo.c (globalize_reg): Reject stack registers.
>
> testsuite/ChangeLog:
>
> 2010-08-17  Uros Bizjak  <ubizjak@gmail.com>
>
>        PR target/45296
>        * gcc.target/i386/pr45296.c: New test.
>
> Tested on x86_64-pc-linux-gnu {,-m32}. OK for mainline and release branches?

Ok.

Thanks,
Richard.

> Uros.
>

Patch hide | download patch | download mbox

Index: testsuite/gcc.target/i386/pr45296.c
===================================================================
--- testsuite/gcc.target/i386/pr45296.c	(revision 0)
+++ testsuite/gcc.target/i386/pr45296.c	(revision 0)
@@ -0,0 +1 @@ 
+register long double F80 __asm__("st"); /* { dg-error "stack register" } */
Index: reginfo.c
===================================================================
--- reginfo.c	(revision 163291)
+++ reginfo.c	(working copy)
@@ -798,6 +798,14 @@  fix_register (const char *name, int fixe
 void
 globalize_reg (int i)
 {
+#ifdef STACK_REGS
+  if (IN_RANGE (i, FIRST_STACK_REG, LAST_STACK_REG))
+    {
+      error ("stack register used for global register variable");
+      return;
+    }
+#endif
+
   if (fixed_regs[i] == 0 && no_global_reg_vars)
     error ("global register variable follows a function definition");