This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc-2.95.1,2/i386 internal error--unrecognizable insn


On Mon, 8 Nov 1999, [iso-8859-1] Etienne LORRAIN wrote:
[a bug report]

Here's a smaller testcase.  Can I install this in the testsuite?

unsigned long foo (unsigned long long x, unsigned long y)
{
    unsigned long a;

    x += y;
	
    asm ("" : "=a" (a) : "A" (x), "rm" (y));

    return a;
}

This causes an internal compiler error with gcc-2.95.2 on ix86-linux.
The current cvs compiler doesn't fail, but I believe the bug is still
present.  There's a place in push_reload that tries to allocate a
register, and for multi-reg values it doesn't verify that all hard
regs actually lie in the right class.

(The patch is against 2.95.2)

Bernd

	* reload.c (push_reload): When selecting a register for
	reload_reg_rtx, make sure that all registers in a multi-reg
	hard register are OK to uye.

--- reload.c.orig-1	Sun Nov 28 11:55:19 1999
+++ reload.c	Sun Nov 28 12:02:03 1999
@@ -1529,12 +1529,20 @@ push_reload (in, out, inloc, outloc, cla
 	    && GET_MODE_SIZE (inmode) <= GET_MODE_SIZE (GET_MODE (XEXP (note, 0)))
 	    && HARD_REGNO_MODE_OK (regno, inmode)
 	    && GET_MODE_SIZE (outmode) <= GET_MODE_SIZE (GET_MODE (XEXP (note, 0)))
-	    && HARD_REGNO_MODE_OK (regno, outmode)
-	    && TEST_HARD_REG_BIT (reg_class_contents[(int) class], regno)
-	    && !fixed_regs[regno])
+	    && HARD_REGNO_MODE_OK (regno, outmode))
 	  {
-	    reload_reg_rtx[i] = gen_rtx_REG (inmode, regno);
-	    break;
+	    int endregno = regno + HARD_REGNO_NREGS (inmode, regno);
+	    while (endregno-- > 0)
+	      if (fixed_regs[regno]
+		  || TEST_HARD_REG_BIT (reg_class_contents[(int) class],
+					regno))
+		break;
+
+	    if (endregno == 0)
+	      {
+		reload_reg_rtx[i] = gen_rtx_REG (inmode, regno);
+		break;
+	      }
 	  }
     }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]