From bd070e1aa9a4f7b6575e6b58a78de2dc708e5d38 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 22 May 1998 16:03:25 -0700 Subject: [PATCH] expr.c (expand_expr): For {BITFIELD,COMPONENT,ARRAY}_REF... * expr.c (expand_expr): For {BITFIELD,COMPONENT,ARRAY}_REF, if the offset's mode is not ptr_mode, convert it. From-SVN: r19965 --- gcc/ChangeLog | 5 +++++ gcc/expr.c | 27 ++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b21e905eb5..1d5d766a658 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +1998-05-23 Richard Henderson + + * expr.c (expand_expr): For {BITFIELD,COMPONENT,ARRAY}_REF, if the + offset's mode is not ptr_mode, convert it. + 1998-05-22 Jason Merrill * fold-const.c (ssize_binop): New fn. diff --git a/gcc/expr.c b/gcc/expr.c index 300e55862af..b8b1ab80c50 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -2907,6 +2907,16 @@ expand_assignment (to, from, want_value, suggest_reg) if (GET_CODE (to_rtx) != MEM) abort (); + + if (GET_MODE (offset_rtx) != ptr_mode) + { +#ifdef POINTERS_EXTEND_UNSIGNED + offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 1); +#else + offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0); +#endif + } + to_rtx = change_address (to_rtx, VOIDmode, gen_rtx_PLUS (ptr_mode, XEXP (to_rtx, 0), force_reg (ptr_mode, offset_rtx))); @@ -3307,7 +3317,7 @@ store_expr (exp, target, want_value) { target = protect_from_queue (target, 1); if (GET_MODE (temp) != GET_MODE (target) - && GET_MODE (temp) != VOIDmode) + && GET_MODE (target) != VOIDmode) { int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp)); if (dont_return_target) @@ -3673,6 +3683,15 @@ store_constructor (exp, target, cleared) if (GET_CODE (to_rtx) != MEM) abort (); + if (GET_MODE (offset_rtx) != ptr_mode) + { +#ifdef POINTERS_EXTEND_UNSIGNED + offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 1); +#else + offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0); +#endif + } + to_rtx = change_address (to_rtx, VOIDmode, gen_rtx_PLUS (ptr_mode, XEXP (to_rtx, 0), @@ -5752,11 +5771,13 @@ expand_expr (exp, target, tmode, modifier) abort (); if (GET_MODE (offset_rtx) != ptr_mode) + { #ifdef POINTERS_EXTEND_UNSIGNED - offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 1); + offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 1); #else - offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0); + offset_rtx = convert_to_mode (ptr_mode, offset_rtx, 0); #endif + } op0 = change_address (op0, VOIDmode, gen_rtx_PLUS (ptr_mode, XEXP (op0, 0), -- 2.30.2