[RFA]: Don't abort in gen_highpart()

Stephane Carrez Stephane.Carrez@worldnet.fr
Wed Dec 6 12:32:00 GMT 2000


Hi!

For 68HC11 target, when gen_highpart(SImode, x) is called with a
mem rtx {like (mem/f:DI (reg:HI 0 x) 19)}, it aborts due to
the following test:


  /* This case loses if X is a subreg.  To catch bugs early,
     complain if an invalid MODE is used even in other cases.  */
  if (GET_MODE_SIZE (mode) > UNITS_PER_WORD
      && GET_MODE_SIZE (mode) != GET_MODE_UNIT_SIZE (GET_MODE (x)))
      abort ();


because I have UNITS_PER_WORD == 2 and also mode == SImode == 4.
Here, the gen_highpart() does not lose as the comment suggest. 
It works perfectly for 68HC11 (big-endian).

I would like approval for the following simple fix to abort only
when X is a SUBREG (as the comment suggest).

Thanks,
	Stephane

2000-12-06  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* emit-rtl.c (gen_highpart): Abort only if the rtx is a SUBREG.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.157
diff -p -r1.157 emit-rtl.c
*** emit-rtl.c	2000/11/30 06:31:17	1.157
--- emit-rtl.c	2000/12/06 20:29:55
*************** gen_highpart (mode, x)
*** 1089,1096 ****
    /* This case loses if X is a subreg.  To catch bugs early,
       complain if an invalid MODE is used even in other cases.  */
    if (GET_MODE_SIZE (mode) > UNITS_PER_WORD
!       && GET_MODE_SIZE (mode) != GET_MODE_UNIT_SIZE (GET_MODE (x)))
!     abort ();
    if (GET_CODE (x) == CONST_DOUBLE
  #if !(TARGET_FLOAT_FORMAT != HOST_FLOAT_FORMAT || defined (REAL_IS_NOT_DOUBLE))
        && GET_MODE_CLASS (GET_MODE (x)) != MODE_FLOAT
--- 1089,1098 ----
    /* This case loses if X is a subreg.  To catch bugs early,
       complain if an invalid MODE is used even in other cases.  */
    if (GET_MODE_SIZE (mode) > UNITS_PER_WORD
!       && GET_MODE_SIZE (mode) != GET_MODE_UNIT_SIZE (GET_MODE (x))
!       && GET_CODE (x) == SUBREG)
!       abort ();
! 
    if (GET_CODE (x) == CONST_DOUBLE
  #if !(TARGET_FLOAT_FORMAT != HOST_FLOAT_FORMAT || defined (REAL_IS_NOT_DOUBLE))
        && GET_MODE_CLASS (GET_MODE (x)) != MODE_FLOAT


More information about the Gcc-patches mailing list