i686 (PentiumPro) Optimizer Bug

H.J. Lu hjl@lucon.org
Wed Dec 16 17:06:00 GMT 1998


Hi,

I am looking into your bug report

http://www.cygnus.com/ml/egcs-bugs/1998-Nov/0476.html

I don't have a real fix yet. But I did find a bug in reg-stack.c which
would silently generate incorrect code. This patch is a sanity check
and it will cause compiler to abort on your testcase instead of
generating buggy asm code. I will work on a real fix when I find more
time.

Thanks.

-- 
H.J. Lu (hjl@gnu.org)
--
Wed Dec 16 07:53:13 1998  H.J. Lu  (hjl@gnu.org)

	* reg-stack.c (subst_stack_regs_pat): Abort if the destination
	of a FP conditional move is not on the FP register stack.

--- /home/work/misc/gnu/import/egcs/gcc/reg-stack.c	Thu Oct  8 12:10:13 1998
+++ ./reg-stack.c	Wed Dec 16 14:45:00 1998
@@ -2349,6 +2349,10 @@ subst_stack_regs_pat (insn, regstack, pa
 	break;
 
       case IF_THEN_ELSE:
+	/* dest has to be on stack. */
+	if (get_hard_regnum (regstack, *dest) < FIRST_STACK_REG)
+	  abort ();
+
 	/* This insn requires the top of stack to be the destination. */
 
 	/* If the comparison operator is an FP comparison operator,
@@ -2402,9 +2406,7 @@ subst_stack_regs_pat (insn, regstack, pa
 	      }
 	}
 
-	/* Make dest the top of stack.  Add dest to regstack if not present. */
-	if (get_hard_regnum (regstack, *dest) < FIRST_STACK_REG)
-	  regstack->reg[++regstack->top] = REGNO (*dest);	
+	/* Make dest the top of stack. */
 	SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
 	replace_reg (dest, FIRST_STACK_REG);
 



More information about the Gcc-bugs mailing list