From: law Date: Wed, 20 Apr 2005 18:02:40 +0000 (+0000) Subject: * reload1.c (reload): Ignore equivalences between pseudos and X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d5d0361c678239b5c1772842db35de00f309c16;p=thirdparty%2Fgcc.git * reload1.c (reload): Ignore equivalences between pseudos and read only memory. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98466 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3fe9d9fa1077..b0863f3a633a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-04-20 Jeff Law + + * reload1.c (reload): Ignore equivalences between pseudos and + read only memory. + 2005-04-20 Joseph S. Myers PR c/12913 diff --git a/gcc/reload1.c b/gcc/reload1.c index 5e1ab1a27ccf..b2200a8d3b39 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -740,8 +740,20 @@ reload (rtx first, int global) that is not a legitimate memory operand. As later stages of reload assume that all addresses found in the reg_equiv_* arrays were originally legitimate, - we ignore such REG_EQUIV notes. */ - if (memory_operand (x, VOIDmode)) + + It can also happen that a REG_EQUIV note contains a + readonly memory location. If the destination pseudo + is set from some other value (typically a different + pseudo), and the destination pseudo does not get a + hard reg, then reload will replace the destination + pseudo with its equivalent memory location. This + is horribly bad as it creates a store to a readonly + memory location and a runtime segfault. To avoid + this problem we reject readonly memory locations + for equivalences. This is overly conservative as + we could find all sets of the destination pseudo + and remove them as they should be redundant. */ + if (memory_operand (x, VOIDmode) && ! MEM_READONLY_P (x)) { /* Always unshare the equivalence, so we can substitute into this insn without touching the