This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Handle (subreg (const_double ...)) in subst.
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 16 Jul 2003 11:04:57 -0600 (MDT)
- Subject: [PATCH] Handle (subreg (const_double ...)) in subst.
The following patch fixes a latent bug uncovered by my RTL optimization
unification experiments. combine.c's subst can potentially substitute a
CONST_DOUBLE into a SUBREG, which is invalid as the CONST_DOUBLE doesn't
have a mode. The solution its to "simplify" the problematic subreg
immediately after the substitution whilst we still have the original
inner mode, as we already do for CONST_INT.
The testcase is gcc.c-torture/execute/20000412-5.c, but this problem
is curently masked as mainline doesn't examine the bad RTX, other than
passing it to recog with fails harmlessly. Other parts of the compiler
are less forgiving :>
The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all languages except treelang, and regression tested
with a top-level "make -k check" with no new failures.
Ok for mainline?
2003-07-16 Roger Sayle <roger@eyesopen.com>
* combine.c (subst): Also handle (subreg (const_double ...)) case
if created by a substitution, by using the original inner mode.
Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.368
diff -c -3 -p -r1.368 combine.c
*** combine.c 10 Jul 2003 20:28:09 -0000 1.368
--- combine.c 16 Jul 2003 03:41:33 -0000
*************** subst (rtx x, rtx from, rtx to, int in_d
*** 3476,3482 ****
if (GET_CODE (new) == CLOBBER && XEXP (new, 0) == const0_rtx)
return new;
! if (GET_CODE (new) == CONST_INT && GET_CODE (x) == SUBREG)
{
enum machine_mode mode = GET_MODE (x);
--- 3476,3484 ----
if (GET_CODE (new) == CLOBBER && XEXP (new, 0) == const0_rtx)
return new;
! if (GET_CODE (x) == SUBREG
! && (GET_CODE (new) == CONST_INT
! || GET_CODE (new) == CONST_DOUBLE))
{
enum machine_mode mode = GET_MODE (x);
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833