optimization/6822: GCC 3.1.1 - Internal compiler error in extract_insn, at recog.c:2132

Eric Botcazou ebotcazou@libertysurf.fr
Wed May 29 09:11:00 GMT 2002


> The problem is that +128 is not a valid QImode constant.
> It should have been rendered as -128.  This should have
> happened during the conversion to rtl, not in the tree
> folding code that Eric touched.

The conversion from +127 into +128 happens here: (sorry for the ill-formatting)

config/i386/i386.c:
int
ix86_expand_int_movcc (operands)
     rtx operands[];
{
  enum rtx_code code = GET_CODE (operands[1]), compare_code;
  rtx compare_seq, compare_op;
  rtx second_test, bypass_test;
  enum machine_mode mode = GET_MODE (operands[0]);

  /* When the compare code is not LTU or GEU, we can not use sbbl case.
     In case comparsion is done with immediate, we can convert it to LTU or
     GEU by altering the integer.  */

  if ((code == LEU || code == GTU)
      && GET_CODE (ix86_compare_op1) == CONST_INT
      && mode != HImode
      && (unsigned int) INTVAL (ix86_compare_op1) != 0xffffffff
      /* The operand still must be representable as sign extended value.  */
      && (!TARGET_64BIT
   || GET_MODE (ix86_compare_op0) != DImode
   || (unsigned int) INTVAL (ix86_compare_op1) != 0x7fffffff)
      && (GET_MODE (ix86_compare_op0) != QImode
   || (unsigned int) INTVAL (ix86_compare_op1) != 0x7f)
      && GET_CODE (operands[2]) == CONST_INT
      && GET_CODE (operands[3]) == CONST_INT)
    {
      if (code == LEU)
 code = LTU;
      else
 code = GEU;
      ix86_compare_op1 = GEN_INT (INTVAL (ix86_compare_op1) + 1);
    }
 

As an evidence, the following 2-line patch lets the ICE vanish:

--- gcc/config/i386/i386.c.orig Wed May 29 17:14:21 2002
+++ gcc/config/i386/i386.c Wed May 29 17:28:45 2002
@@ -7963,6 +7963,8 @@
       && (!TARGET_64BIT
    || GET_MODE (ix86_compare_op0) != DImode
    || (unsigned int) INTVAL (ix86_compare_op1) != 0x7fffffff)
+      && (GET_MODE (ix86_compare_op0) != QImode
+   || (unsigned int) INTVAL (ix86_compare_op1) != 0x7f)
       && GET_CODE (operands[2]) == CONST_INT
       && GET_CODE (operands[3]) == CONST_INT)
     {


What's your diagnosis ?

--
Eric Botcazou
ebotcazou@multimania.com



More information about the Gcc-bugs mailing list