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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-04-06
         AssignedTo|unassigned at gcc dot       |ubizjak at gmail dot com
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #1 from Uros Bizjak <ubizjak at gmail dot com> 2012-04-06 09:13:23 
UTC ---
Confirmed.

simplify_const_unary_operation tries to simplify:

(zero_extend:DI (const_int 0 [0]))

and trips on assert where:

      /* When zero-extending a CONST_INT, we need to know its
             original mode.  */

There is nothing wrong with the above RTX, so there is no justification to
trigger the ICE. The compiler should simply reject to simplify this RTX.

I am testing following patch:

--cut here--
Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c      (revision 186182)
+++ simplify-rtx.c      (working copy)
@@ -1461,7 +1461,9 @@ simplify_const_unary_operation (enum rtx_code code
        case ZERO_EXTEND:
          /* When zero-extending a CONST_INT, we need to know its
              original mode.  */
-         gcc_assert (op_mode != VOIDmode);
+         if (op_mode == VOIDmode)
+           return 0;
+
          if (op_width == HOST_BITS_PER_WIDE_INT)
            {
              /* If we were really extending the mode,
@@ -1628,9 +1630,8 @@ simplify_const_unary_operation (enum rtx_code code
          break;

        case ZERO_EXTEND:
-         gcc_assert (op_mode != VOIDmode);
-
-         if (op_width > HOST_BITS_PER_WIDE_INT)
+         if (op_mode == VOIDmode
+             || op_width > HOST_BITS_PER_WIDE_INT)
            return 0;

          hv = 0;
--cut here--

Reply via email to