summaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-20 13:24:25 +0000
committerbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-20 13:24:25 +0000
commite077413c83bd275712a090af9ddc1050b2b6b1fc (patch)
tree2acfe8d530f75855ee473340ea29ef01eb9183a8 /gcc/emit-rtl.c
parent8c2fa2f7f88da2e031cadb569896cf343ee4c7bc (diff)
downloadgcc-e077413c83bd275712a090af9ddc1050b2b6b1fc.tar.gz
gcc:
2008-01-20 Paolo Bonzini <bonzini@gnu.org> PR target/38868 * emit-rtl.c (adjust_address_1): Make sure memref is never overwritten. gcc/testsuite: 2008-01-20 Paolo Bonzini <bonzini@gnu.org> PR target/38868 * gfortran.dg/pr38868.f: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143513 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 830ce1dc910..679e95ea8a2 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1,6 +1,6 @@
/* Emit RTL for the GCC expander.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
@@ -2035,6 +2035,11 @@ adjust_address_1 (rtx memref, enum machine_mode mode, HOST_WIDE_INT offset,
new_rtx = change_address_1 (memref, mode, addr, validate);
+ /* If the address is a REG, change_address_1 rightfully returns memref,
+ but this would destroy memref's MEM_ATTRS. */
+ if (new_rtx == memref && offset != 0)
+ new_rtx = copy_rtx (new_rtx);
+
/* Compute the new values of the memory attributes due to this adjustment.
We add the offsets and update the alignment. */
if (memoffset)