POINTERS_EXTEND_UNSIGNED fix (found on IA64 HP-UX)

Richard Henderson rth@redhat.com
Wed Jul 17 10:44:00 GMT 2002


On Wed, Jul 17, 2002 at 09:57:39AM -0700, Steve Ellcey wrote:
> Now, if we are truncating I don't think there is any problem, but if we
> are extending a PLUS operator then we are calling convert_memory_address
> with both sides of the PLUS and I think that is wrong because we are
> really adding together an address and an offset, not two addresses and
> if we zero-extended both the address and the offset and if the offset is
> actually a negative CONST_INT won't that turn the offset into a large
> positive number and won't that mean that when we add them together we
> will get the wrong result compared with adding the two values together
> first and then extending the result of the PLUS.

As I also said, the permutation is invalid if the constant is
changed by the conversion.  Thus one ought to have

  if (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (from_mode)
      || (POINTERS_EXTEND_UNSIGNED >= 0
	  && GET_CODE (x) == PLUS
	  && GET_CODE (XEXP (x, 1)) == CONST_INT
	  && XEXP (x, 1) == convert_memory_address (to_mode, XEXP (x, 1))))
    return gen_rtx_fmt_ee (GET_CODE (x), to_mode,
                           convert_memory_address (to_mode, XEXP (x, 0)),
			   XEXP (x, 1));


r~



More information about the Gcc-patches mailing list