[Bug middle-end/51895] [4.7 Regression] ICE in simplify_subreg

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 19 13:38:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51895

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-19 13:17:25 UTC ---
For example (untested, and probably completely bogus):

Index: expr.c
===================================================================
--- expr.c      (revision 183296)
+++ expr.c      (working copy)
@@ -1517,7 +1517,9 @@ move_block_to_reg (int regno, rtx x, int

   for (i = 0; i < nregs; i++)
     emit_move_insn (gen_rtx_REG (word_mode, regno + i),
-                   operand_subword_force (x, i, mode));
+                   operand_subword_force (x, i,
+                                          CONSTANT_P (x)
+                                          ? mode : GET_MODE (x)));
 }

 /* Copy all or part of a BLKmode value X out of registers starting at REGNO.

As written elsewhere operand_subword* should be deprecated ... so maybe
we can use sth else in move_block_to_reg?

The same effect could be achieved by changing operand_subword to adhere
to its documentation and ignore mode if op is !CONST_INT_P ... thus

Index: emit-rtl.c
===================================================================
--- emit-rtl.c  (revision 183296)
+++ emit-rtl.c  (working copy)
@@ -1367,7 +1367,7 @@ paradoxical_subreg_p (const_rtx x)
 rtx
 operand_subword (rtx op, unsigned int offset, int validate_address, enum
machine_mode mode)
 {
-  if (mode == VOIDmode)
+  if (!CONST_INT_P (op))
     mode = GET_MODE (op);

   gcc_assert (mode != VOIDmode);

Both fix the testcase.



More information about the Gcc-bugs mailing list