Commit e2655d15 by Ulrich Weigand Committed by Ulrich Weigand

re PR middle-end/15054 (Bad code due to overlapping stack temporaries)

	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.

	PR middle-end/15054
	* g++.dg/opt/pr15054.C: New test.

From-SVN: r81384
parent 77306e3e
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
......
......@@ -8537,8 +8537,6 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
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);
......
......@@ -780,7 +780,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size, int keep
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.
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment