[PATCH] Call validize_mem in assign_386_stack_local (PR target/50092)

Jakub Jelinek jakub@redhat.com
Thu Aug 18 14:21:00 GMT 2011


Hi!

If stack frame size is larger than 2GB, the MEMs returned by
assign_386_stack_local aren't necessarily valid MEMs.  While we could do
validize_mem in all the assign_386_stack_local callers, it seems far easier
to do it just in one (well, two actually) spots.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.6?

2011-08-18  Jakub Jelinek  <jakub@redhat.com>

	PR target/50092
	* config/i386/i386.c (assign_386_stack_local): Call validize_mem
	on the result before returning it.

	* gcc.dg/torture/pr50092.c: New test.

--- gcc/config/i386/i386.c.jj	2011-08-18 08:35:53.000000000 +0200
+++ gcc/config/i386/i386.c	2011-08-18 11:16:41.000000000 +0200
@@ -21787,7 +21787,7 @@ assign_386_stack_local (enum machine_mod
 
   for (s = ix86_stack_locals; s; s = s->next)
     if (s->mode == mode && s->n == n)
-      return copy_rtx (s->rtl);
+      return validize_mem (copy_rtx (s->rtl));
 
   s = ggc_alloc_stack_local_entry ();
   s->n = n;
@@ -21796,7 +21796,7 @@ assign_386_stack_local (enum machine_mod
 
   s->next = ix86_stack_locals;
   ix86_stack_locals = s;
-  return s->rtl;
+  return validize_mem (s->rtl);
 }
 
 /* Calculate the length of the memory address in the instruction encoding.
--- gcc/testsuite/gcc.dg/torture/pr50092.c.jj	2011-08-18 11:27:07.000000000 +0200
+++ gcc/testsuite/gcc.dg/torture/pr50092.c	2011-08-18 11:27:39.000000000 +0200
@@ -0,0 +1,15 @@
+/* PR target/50092 */
+/* { dg-do compile { target lp64 } } */
+
+volatile int v;
+
+void bar (long double);
+void baz (_Complex long double *);
+
+void
+foo (void)
+{
+  _Complex long double w[100000000];
+  bar ((long double) v / 2147483648.0);
+  baz (w);
+}

	Jakub



More information about the Gcc-patches mailing list