[Bug middle-end/40154] [4.4/4.5 Regression] internal compiler error: in do_SUBST, at combine.c:681

kkojima at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat May 16 00:08:00 GMT 2009



------- Comment #1 from kkojima at gcc dot gnu dot org  2009-05-16 00:08 -------
I've tried to see what is going on with -da.
.expand rtl dump shows that t *= 1000000000 is compiled to
a sequence of insns and the last two insns are:

(insn 87 86 88 ice.i:6 (parallel [
            (set (subreg:SI (reg:DI 220) 0)
                (ashift:SI (subreg:SI (reg:DI 218) 0)
                    (const_int 9 [0x9])))
            (clobber (scratch:SI))
        ]) -1 (expr_list:REG_EQUAL (mult:DI (reg:DI 169)
            (const_int 1000000000 [0x3b9aca00]))
        (nil)))

(insn 88 87 0 ice.i:6 (set (mem/c/i:DI (plus:SI (reg/f:SI 167)
                (const_int 56 [0x38])) [0 t+0 S8 A32])
        (reg:DI 220)) -1 (nil))

Then CSE pass folds the constant multiplication and replaces
the above insn 87 with

(insn 87 86 108 2 ice.i:6 (set (reg:SI 229)
        (const_int -1539607552 [0xffffffffa43b7400])) 175 {movsi_ie}
(expr_list:REG_EQUAL (const_int 50000000000 [0xba43b7400])
        (nil)))

and do_SUBST complains that SImode reg can't hold 50000000000
at the combine pass.
I guess that the REG_EQUAL note of the original insn 87 is
suspicious.  It seems that the patch below avoids the problem,
though it may be completely wrong.  I'll ask the middle-end
experts on the gcc list about this issue.

--- ORIG/trunk/gcc/expmed.c     2009-05-12 19:17:54.000000000 +0900
+++ trunk/gcc/expmed.c  2009-05-16 08:34:14.000000000 +0900
@@ -2958,7 +2958,7 @@ expand_mult_const (enum machine_mode mod
                   enum mult_variant variant)
 {
   HOST_WIDE_INT val_so_far;
-  rtx insn, accum, tem;
+  rtx insn, accum, tem, set;
   int opno;
   enum machine_mode nmode;

@@ -3074,9 +3074,12 @@ expand_mult_const (enum machine_mode mod
        }

       insn = get_last_insn ();
-      set_unique_reg_note (insn, REG_EQUAL,
-                          gen_rtx_MULT (nmode, tem,
-                                        GEN_INT (val_so_far)));
+      set = single_set (insn);
+      if (set != 0
+         && GET_MODE (SET_DEST (set)) == nmode)
+       set_unique_reg_note (insn, REG_EQUAL,
+                            gen_rtx_MULT (nmode, tem,
+                                          GEN_INT (val_so_far)));
     }

   if (variant == negate_variant)


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kkojima at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.4.0 4.5.0
      Known to work|                            |4.3.3
           Priority|P3                          |P4
   Last reconfirmed|0000-00-00 00:00:00         |2009-05-16 00:08:06
               date|                            |
            Summary|internal compiler error: in |[4.4/4.5 Regression]
                   |do_SUBST, at combine.c:681  |internal compiler error: in
                   |                            |do_SUBST, at combine.c:681


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



More information about the Gcc-bugs mailing list