Blame SOURCES/gcc32-rh186252.patch

6f1b0c
2004-05-01 Ulrich Weigand <weigand@de.ibm.com>
6f1b0c
6f1b0c
	PR middle-end/15054
6f1b0c
	* expr.c (expand_expr_real): Do not call preserve_temp_slots 
6f1b0c
	on a TARGET_EXPR temp.
6f1b0c
	* function.c (assign_stack_temp_for_type): Set 'keep' flag for
6f1b0c
	TARGET_EXPR temp slots.
6f1b0c
6f1b0c
	* g++.dg/opt/pr15054.C: New test.
6f1b0c
6f1b0c
2006-04-25  Jakub Jelinek  <jakub@redhat.com>
6f1b0c
6f1b0c
	* g++.dg/opt/pr15054-2.C: New test.
6f1b0c
6f1b0c
--- gcc/expr.c.orig	2006-02-24 04:51:46.000000000 -0300
6f1b0c
+++ gcc/expr.c	2006-04-11 03:53:02.000000000 -0300
6f1b0c
@@ -8676,8 +8676,6 @@ expand_expr (exp, target, tmode, modifie
6f1b0c
 	    else
6f1b0c
 	      {
6f1b0c
 		target = assign_temp (type, 2, 0, 1);
6f1b0c
-		/* All temp slots at this level must not conflict.  */
6f1b0c
-		preserve_temp_slots (target);
6f1b0c
 		SET_DECL_RTL (slot, target);
6f1b0c
 		if (TREE_ADDRESSABLE (slot))
6f1b0c
 		  put_var_into_stack (slot);
6f1b0c
--- gcc/function.c.orig	2006-02-24 04:51:52.000000000 -0300
6f1b0c
+++ gcc/function.c	2006-04-11 03:53:02.000000000 -0300
6f1b0c
@@ -803,7 +803,7 @@ assign_stack_temp_for_type (mode, size, 
6f1b0c
   if (keep == 2)
6f1b0c
     {
6f1b0c
       p->level = target_temp_slot_level;
6f1b0c
-      p->keep = 0;
6f1b0c
+      p->keep = 1;
6f1b0c
     }
6f1b0c
   else if (keep == 3)
6f1b0c
     {
6f1b0c
--- gcc/testsuite/g++.dg/opt/pr15054.C	1970-01-01 00:00:00.000000000 +0000
6f1b0c
+++ gcc/testsuite/g++.dg/opt/pr15054.C	2006-04-11 03:54:31.000000000 -0300
6f1b0c
@@ -0,0 +1,36 @@
6f1b0c
+// PR middle-end/15054
6f1b0c
+// This used to abort due to overlapping stack temporaries.
6f1b0c
+
6f1b0c
+// { dg-do run }
6f1b0c
+// { dg-options "-O" }
6f1b0c
+
6f1b0c
+extern "C" void abort (void);
6f1b0c
+
6f1b0c
+struct pointer
6f1b0c
+{
6f1b0c
+  void* ptr;
6f1b0c
+
6f1b0c
+  pointer(void* x = 0) : ptr(x) {}
6f1b0c
+  pointer(const pointer& x) : ptr(x.ptr) {}
6f1b0c
+};
6f1b0c
+
6f1b0c
+struct element
6f1b0c
+{
6f1b0c
+  int canary;
6f1b0c
+
6f1b0c
+  element() : canary(123) { }
6f1b0c
+  ~element() { pointer(); if (canary != 123) abort (); }
6f1b0c
+};
6f1b0c
+
6f1b0c
+inline pointer
6f1b0c
+insert(const element& x)
6f1b0c
+{
6f1b0c
+  return pointer(new element(x));
6f1b0c
+}
6f1b0c
+
6f1b0c
+int
6f1b0c
+main (void)
6f1b0c
+{
6f1b0c
+  insert(element());
6f1b0c
+  return 0;
6f1b0c
+}
6f1b0c
--- gcc/testsuite/g++.dg/opt/pr15054-2.C	2006-04-19 19:21:31.748476000 +0200
6f1b0c
+++ gcc/testsuite/g++.dg/opt/pr15054-2.C	2006-04-25 15:55:07.000000000 +0200
6f1b0c
@@ -0,0 +1,39 @@
6f1b0c
+// PR middle-end/15054
6f1b0c
+
6f1b0c
+// { dg-do run }
6f1b0c
+// { dg-options "-O2" }
6f1b0c
+
6f1b0c
+extern "C" void abort (void);
6f1b0c
+
6f1b0c
+void
6f1b0c
+__attribute__((noinline))
6f1b0c
+check (long x, long y)
6f1b0c
+{
6f1b0c
+  if (x != y)
6f1b0c
+    abort ();
6f1b0c
+}
6f1b0c
+
6f1b0c
+struct A
6f1b0c
+{
6f1b0c
+  A() : a(2) { check (a, 2); }
6f1b0c
+  ~A() { check (a, 2); }
6f1b0c
+private:
6f1b0c
+  long a;
6f1b0c
+};
6f1b0c
+
6f1b0c
+class B {
6f1b0c
+  long b;
6f1b0c
+  B& operator =(const B& );
6f1b0c
+public:
6f1b0c
+  B (long p) : b(p) { check (b, 6); }
6f1b0c
+  B (const B& p) : b(p.b) { check (b, 6); }
6f1b0c
+  ~B () { check (b, 6); A obj; check (b, 6); }
6f1b0c
+  B foo() { return B(*this); }
6f1b0c
+};
6f1b0c
+
6f1b0c
+int main ()
6f1b0c
+{
6f1b0c
+  B o(6);
6f1b0c
+  o.foo().foo();
6f1b0c
+  return 0;
6f1b0c
+}