Various expr.c fixes
Richard Kenner
kenner@vlsi1.ultra.nyu.edu
Thu Dec 13 17:41:00 GMT 2001
The first is self-explanatory. The second is to fix a problem relating
to RTX_UNCHANGING_P being set incorectly on some stores. RTH has the
test case here. The third prevents ICE on programs that have arrays
whose components have a size that overflows (this is from the Ada
ACATS).
Tested on alphaev56-dec-osf4.0c.
Thu Dec 13 20:30:08 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expr.c (copy_blkmode_from_reg): Add missing braces to eliminate
warning and reformat comments.
(expand_assignment): Don't pass EXPAND_WRITE if LHS is component.
(highest_pow2_factor, case INTEGER_CST): Return BIGGEST_ALIGNMENT
if overflow.
*** expr.c 2001/12/12 12:40:27 1.397
--- expr.c 2001/12/13 20:55:24
*************** copy_blkmode_from_reg (tgtblk, srcreg, t
*** 2164,2180 ****
}
! /* This code assumes srcreg is at least a full word. If it isn't,
! copy it into a new pseudo which is a full word. */
! /* If FUNCTION_ARG_REG_LITTLE_ENDIAN is set and convert_to_mode does
! a copy, the wrong part of the register gets copied so we fake
! a type conversion in place. */
!
if (GET_MODE (srcreg) != BLKmode
&& GET_MODE_SIZE (GET_MODE (srcreg)) < UNITS_PER_WORD)
! if (FUNCTION_ARG_REG_LITTLE_ENDIAN)
! srcreg = simplify_gen_subreg (word_mode, srcreg, GET_MODE (srcreg), 0);
! else
! srcreg = convert_to_mode (word_mode, srcreg, TREE_UNSIGNED (type));
/* Structures whose size is not a multiple of a word are aligned
--- 2164,2181 ----
}
! /* This code assumes srcreg is at least a full word. If it isn't, copy it
! into a new pseudo which is a full word.
! If FUNCTION_ARG_REG_LITTLE_ENDIAN is set and convert_to_mode does a copy,
! the wrong part of the register gets copied so we fake a type conversion
! in place. */
if (GET_MODE (srcreg) != BLKmode
&& GET_MODE_SIZE (GET_MODE (srcreg)) < UNITS_PER_WORD)
! {
! if (FUNCTION_ARG_REG_LITTLE_ENDIAN)
! srcreg = simplify_gen_subreg (word_mode, srcreg, GET_MODE (srcreg), 0);
! else
! srcreg = convert_to_mode (word_mode, srcreg, TREE_UNSIGNED (type));
! }
/* Structures whose size is not a multiple of a word are aligned
*************** expand_assignment (to, from, want_value,
*** 3645,3651 ****
if (mode1 == VOIDmode && want_value)
tem = stabilize_reference (tem);
- orig_to_rtx = to_rtx = expand_expr (tem, NULL_RTX, VOIDmode,
- EXPAND_WRITE);
if (offset != 0)
{
--- 3646,3652 ----
if (mode1 == VOIDmode && want_value)
tem = stabilize_reference (tem);
+
+ orig_to_rtx = to_rtx = expand_expr (tem, NULL_RTX, VOIDmode, 0);
if (offset != 0)
{
*************** highest_pow2_factor (exp)
*** 5795,5800 ****
lowest bit that's a one. If the result is zero, pessimize by
returning 1. This is overly-conservative, but such things should not
! happen in the offset expressions that we are called with. */
! if (host_integerp (exp, 0))
{
c0 = tree_low_cst (exp, 0);
--- 5796,5805 ----
lowest bit that's a one. If the result is zero, pessimize by
returning 1. This is overly-conservative, but such things should not
! happen in the offset expressions that we are called with. If
! the constant overlows, we some erroneous program, so return
! BIGGEST_ALIGNMENT to avoid any later ICE. */
! if (TREE_CONSTANT_OVERFLOW (exp))
! return BIGGEST_ALIGNMENT;
! else if (host_integerp (exp, 0))
{
c0 = tree_low_cst (exp, 0);
More information about the Gcc-patches
mailing list