This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PR41276, PR41307] don't leak VALUEs into VAR_LOCATION NOTEs
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 08 Sep 2009 12:40:11 -0300
- Subject: [PR41276, PR41307] don't leak VALUEs into VAR_LOCATION NOTEs
When a VALUE in var-tracking expands to a hard reg, and we want a subreg
of that value but the hard reg can't hold that mode, we end up returning
the original subreg of a value, which is inappropriate.
This patch ensures that we don't. I'm going to check it in as obvious.
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR debug/41276
PR debug/41307
* cselib.c (cselib_expand_value_rtx_1): Don't return copy of
invalid subreg.
Index: gcc/cselib.c
===================================================================
--- gcc/cselib.c.orig 2009-09-07 06:49:48.000000000 -0300
+++ gcc/cselib.c 2009-09-07 06:50:06.000000000 -0300
@@ -1165,12 +1165,12 @@ cselib_expand_value_rtx_1 (rtx orig, str
scopy = simplify_gen_subreg (GET_MODE (orig), subreg,
GET_MODE (SUBREG_REG (orig)),
SUBREG_BYTE (orig));
- if (scopy == NULL
- || (GET_CODE (scopy) == SUBREG
- && !REG_P (SUBREG_REG (scopy))
- && !MEM_P (SUBREG_REG (scopy))
- && (REG_P (SUBREG_REG (orig))
- || MEM_P (SUBREG_REG (orig)))))
+ if ((scopy == NULL
+ || (GET_CODE (scopy) == SUBREG
+ && !REG_P (SUBREG_REG (scopy))
+ && !MEM_P (SUBREG_REG (scopy))))
+ && (REG_P (SUBREG_REG (orig))
+ || MEM_P (SUBREG_REG (orig))))
return shallow_copy_rtx (orig);
return scopy;
}
--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist Red Hat Brazil Compiler Engineer