------- Comment #4 from nemet at gcc dot gnu dot org 2009-01-14 21:48 -------
It only happens on SHIFT_COUNT_TRUNCATED targets (i.e. mips but not x86).
I will do some more digging on the history of the SHIFT_COUNT_TRUNCATED code
here but this patch fixes the ICE:
Index: expmed.c
===================================================================
--- expmed.c (revision 143286)
+++ expmed.c (working copy)
@@ -2119,21 +2119,22 @@ expand_shift (enum tree_code code, enum
on all machines. */
if (SHIFT_COUNT_TRUNCATED)
{
if (GET_CODE (op1) == CONST_INT
&& ((unsigned HOST_WIDE_INT) INTVAL (op1) >=
(unsigned HOST_WIDE_INT) GET_MODE_BITSIZE (mode)))
op1 = GEN_INT ((unsigned HOST_WIDE_INT) INTVAL (op1)
% GET_MODE_BITSIZE (mode));
else if (GET_CODE (op1) == SUBREG
- && subreg_lowpart_p (op1))
+ && subreg_lowpart_p (op1)
+ && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1))))
op1 = SUBREG_REG (op1);
}
if (op1 == const0_rtx)
return shifted;
/* Check whether its cheaper to implement a left shift by a constant
bit count by a sequence of additions. */
if (code == LSHIFT_EXPR
&& GET_CODE (op1) == CONST_INT
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38554