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]

combiner bug



I'm not real familiar with this code, but this might be the fix.  Basically
we can't assume the result of a (eq/ne (blah) (const_int 0)) will have
the value 0 or 1.  It will have the value 0 or STORE_FLAG_VALUE (aka
const_true_rtx).

Your input on this would be greatly appreciated.

	* combine.c (if_then_else_cond): Use const_true_rtx instead of
	const1_rtx for return values in EQ/NE comparison against (const_int 0)
	case.

Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.95
diff -c -3 -p -r1.95 combine.c
*** combine.c	1999/11/30 23:19:06	1.95
--- combine.c	1999/12/01 07:56:39
*************** if_then_else_cond (x, ptrue, pfalse)
*** 7037,7044 ****
    if ((code == NE || code == EQ)
        && GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 0)
      {
!       *ptrue = (code == NE) ? const1_rtx : const0_rtx;
!       *pfalse = (code == NE) ? const0_rtx : const1_rtx;
        return XEXP (x, 0);
      }
  
--- 7037,7044 ----
    if ((code == NE || code == EQ)
        && GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 0)
      {
!       *ptrue = (code == NE) ? const_true_rtx : const0_rtx;
!       *pfalse = (code == NE) ? const0_rtx : const_true_rtx;
        return XEXP (x, 0);
      }
  






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