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]
Other format: [Raw text]

[3.3/mainline,obvious] Fix PR/12292


Hello,

this patch fixes a bug in combine.c.
It checks whether GET_CODE (XXX) is CONST_INT before using 
INTVAL (XXX), like it is tested several lines above.

Bootstrapped/regtested x86-64 3.3 branch and mainline.
I'm commiting it as obvious.

Josef

2003-10-02  Josef Zlomek  <zlomekj@suse.cz>

	PR/12292
	* combine.c (make_field_assignment): Check whether rtx's code
	is CONST_INT before using INTVAL.

Index: combine.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/combine.c,v
retrieving revision 1.388
diff -c -1 -7 -p -r1.388 combine.c
*** combine.c	26 Sep 2003 06:05:48 -0000	1.388
--- combine.c	2 Oct 2003 08:39:04 -0000
*************** make_field_assignment (rtx x)
*** 7652,7685 ****
--- 7652,7686 ----
    if (GET_CODE (src) == AND && GET_CODE (XEXP (src, 0)) == ROTATE
        && GET_CODE (XEXP (XEXP (src, 0), 0)) == CONST_INT
        && INTVAL (XEXP (XEXP (src, 0), 0)) == -2
        && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1)))
      {
        assign = make_extraction (VOIDmode, dest, 0, XEXP (XEXP (src, 0), 1),
  				1, 1, 1, 0);
        if (assign != 0)
  	return gen_rtx_SET (VOIDmode, assign, const0_rtx);
        return x;
      }
  
    else if (GET_CODE (src) == AND && GET_CODE (XEXP (src, 0)) == SUBREG
  	   && subreg_lowpart_p (XEXP (src, 0))
  	   && (GET_MODE_SIZE (GET_MODE (XEXP (src, 0)))
  	       < GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (src, 0)))))
  	   && GET_CODE (SUBREG_REG (XEXP (src, 0))) == ROTATE
+ 	   && GET_CODE (XEXP (SUBREG_REG (XEXP (src, 0)), 0)) == CONST_INT
  	   && INTVAL (XEXP (SUBREG_REG (XEXP (src, 0)), 0)) == -2
  	   && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1)))
      {
        assign = make_extraction (VOIDmode, dest, 0,
  				XEXP (SUBREG_REG (XEXP (src, 0)), 1),
  				1, 1, 1, 0);
        if (assign != 0)
  	return gen_rtx_SET (VOIDmode, assign, const0_rtx);
        return x;
      }
  
    /* If SRC is (ior (ashift (const_int 1) POS) DEST), this is a set of a
       one-bit field.  */
    else if (GET_CODE (src) == IOR && GET_CODE (XEXP (src, 0)) == ASHIFT
  	   && XEXP (XEXP (src, 0), 0) == const1_rtx
  	   && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1)))
      {


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