+2004-05-01 Ulrich Weigand <uweigand@de.ibm.com>
+
+ PR middle-end/15054
+ * expr.c (expand_expr_real): Do not call preserve_temp_slots
+ on a TARGET_EXPR temp.
+ * function.c (assign_stack_temp_for_type): Set 'keep' flag for
+ TARGET_EXPR temp slots.
+
2004-05-01 Paolo Bonzini <bonzini@gnu.org>
* simplify-rtx.c (simplify_ternary_operation): When
else
{
target = assign_temp (type, 2, 0, 1);
- /* All temp slots at this level must not conflict. */
- preserve_temp_slots (target);
SET_DECL_RTL (slot, target);
if (TREE_ADDRESSABLE (slot))
put_var_into_stack (slot, /*rescan=*/false);
if (keep == 2)
{
p->level = target_temp_slot_level;
- p->keep = 0;
+ p->keep = 1;
}
else if (keep == 3)
{
+2004-05-01 Ulrich Weigand <uweigand@de.ibm.com>
+
+ PR middle-end/15054
+ * g++.dg/opt/pr15054.C: New test.
+
2004-04-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-rounding-1.c: New test.
--- /dev/null
+// PR middle-end/15054
+// This used to abort due to overlapping stack temporaries.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort (void);
+
+struct pointer
+{
+ void* ptr;
+
+ pointer(void* x = 0) : ptr(x) {}
+ pointer(const pointer& x) : ptr(x.ptr) {}
+};
+
+struct element
+{
+ int canary;
+
+ element() : canary(123) { }
+ ~element() { pointer(); if (canary != 123) abort (); }
+};
+
+inline pointer
+insert(const element& x)
+{
+ return pointer(new element(x));
+}
+
+int
+main (void)
+{
+ insert(element());
+ return 0;
+}