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]

combine bug fix.


All

While trying to build newlib on for x86-x-m68k-elf toolchain with enable-checking
enabled compiler I encountered the following abort

/usr/local/src/newlib/newlib-1.9.0/newlib/libm/math/k_rem_pio2.c: In function `__kernel_rem_pio2':
/usr/local/src/newlib/newlib-1.9.0/newlib/libm/math/k_rem_pio2.c:318: RTL check: access of elt 1 of `not' with last elt 0 in combine_simplify_rtx, at combine.c:3868

The RTL in question was

(not:SI (ashiftrt:SI (reg:SI 55)
        (const_int 2 [0x2])))

The problem occurrs because we are trying to apply XEXP (x, 1) 
on the above RTL. Now NOT only has one operand so this wrong.

The XEXP (x, 1) appears apart of a XEXP (x, 1) == const1_rtx
test which looks entirely bogus to me so I have deleted the
test and I have updated the comment to include the NOT so that
so that the transformation actually makes sense.

Bootstrapped x86-linux.

ChangeLog

	* combine.c (combine_simplify_rtx): Update comment and
	remove erroneous test.

-----------------------------------------------------------------------
 Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.223
diff -c -p -r1.223 combine.c
*** combine.c   2001/07/30 10:54:10     1.223
--- combine.c   2001/07/31 15:44:46
*************** combine_simplify_rtx (x, op0_mode, last,
*** 3856,3868 ****
                                              XEXP (XEXP (x, 0), 1))))
        return reversed;

!       /* (ashiftrt foo C) where C is the number of bits in FOO minus 1
!        is (lt foo (const_int 0)) if STORE_FLAG_VALUE is -1, so we can
         perform the above simplification.  */

        if (STORE_FLAG_VALUE == -1
          && GET_CODE (XEXP (x, 0)) == ASHIFTRT
-         && XEXP (x, 1) == const1_rtx
          && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
          && INTVAL (XEXP (XEXP (x, 0), 1)) == GET_MODE_BITSIZE (mode) - 1)
        return gen_rtx_GE (mode, XEXP (XEXP (x, 0), 0), const0_rtx);
--- 3856,3867 ----
                                              XEXP (XEXP (x, 0), 1))))
        return reversed;

!       /* (not (ashiftrt foo C)) where C is the number of bits in FOO minus 1
!        is (ge foo (const_int 0)) if STORE_FLAG_VALUE is -1, so we can
         perform the above simplification.  */

        if (STORE_FLAG_VALUE == -1
          && GET_CODE (XEXP (x, 0)) == ASHIFTRT
          && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
          && INTVAL (XEXP (XEXP (x, 0), 1)) == GET_MODE_BITSIZE (mode) - 1)
        return gen_rtx_GE (mode, XEXP (XEXP (x, 0), 0), const0_rtx);
-----------------------------------------------------------------------------


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