aboutsummaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-04-28 21:47:12 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2002-04-28 21:47:12 +0200
commita20fd5ac2eb9316dd87135ceb445702dc4d78aa2 (patch)
treeea8960f1f233199a802a603713111bcde03517c8 /gcc/reload1.c
parent87ed109f1f7fab7afc05afca460523a2493c0f43 (diff)
downloadgcc-a20fd5ac2eb9316dd87135ceb445702dc4d78aa2.zip
gcc-a20fd5ac2eb9316dd87135ceb445702dc4d78aa2.tar.gz
gcc-a20fd5ac2eb9316dd87135ceb445702dc4d78aa2.tar.bz2
re PR rtl-optimization/6475 (zlib miscompilation with gcc-3.1)
PR optimization/6475 * reload1.c (alter_reg): Only call set_mem_expr if I is home pseudo register of REGNO_DECL (i). * Makefile.in (reload1.o): Add $(TREE_H). * gcc.dg/20020426-2.c: New test. From-SVN: r52855
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index cf807af..840b1cb 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -41,6 +41,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "real.h"
#include "toplev.h"
#include "except.h"
+#include "tree.h"
/* This file contains the reload pass of the compiler, which is
run after register allocation has been done. It checks that
@@ -2067,10 +2068,19 @@ alter_reg (i, from_reg)
memory. If this is a shared MEM, make a copy. */
if (REGNO_DECL (i))
{
- if (from_reg != -1 && spill_stack_slot[from_reg] == x)
- x = copy_rtx (x);
+ rtx decl = DECL_RTL_IF_SET (REGNO_DECL (i));
- set_mem_expr (x, REGNO_DECL (i));
+ /* We can do this only for the DECLs home pseudo, not for
+ any copies of it, since otherwise when the stack slot
+ is reused, nonoverlapping_memrefs_p might think they
+ cannot overlap. */
+ if (decl && GET_CODE (decl) == REG && REGNO (decl) == (unsigned) i)
+ {
+ if (from_reg != -1 && spill_stack_slot[from_reg] == x)
+ x = copy_rtx (x);
+
+ set_mem_expr (x, REGNO_DECL (i));
+ }
}
/* Save the stack slot for later. */