This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: bug fix for array references
- To: egcs-patches at cygnus dot com
- Subject: Re: bug fix for array references
- From: Peter Gerwinski <peter at gerwinski dot de>
- Date: Fri, 28 Aug 1998 18:03:44 +0200
- Cc: Matthias Klose <doko at cs dot tu-berlin dot de>
- References: <19980828154401.E907@esmeralda.gerwinski.de>
Hello again,
I (Peter Gerwinski) wrote:
>
> I suspect that there is a bug in `expr.c'. When expanding an
> array reference with a non-constant index, `copy_to_mode_reg()'
> (called from `expand_mult()') barfs about incompatible modes on
> machines where `sizetype' is not `int', e.g. the Alpha.
Sorry - the patch contained a very stupid typo caused by moving
the changes from one host to another manually. #-) It must be
`convert (some_type, some_value)', and not `convert (some_value,
some_type)', of course. (I strongly wonder why this did not show
up earlier during my tests.)
Greetings,
Peter Gerwinski, Essen, Germany, http://home.pages.de/~Peter.Gerwinski/
Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-980511
PGP key on request - 6C 94 45 BE 28 A4 96 - 0E CC E9 12 47 25 82 75
Fight the SPAM and UBE! - http://spam.abuse.net/ - http://maps.vix.com/
8< ---- corrected patch follows ----------------------------------------
*** ChangeLog.orig Fri Aug 28 15:30:13 1998
--- ChangeLog Fri Aug 28 15:31:11 1998
***************
*** 1,3 ****
--- 1,8 ----
+ Fri Aug 28 15:10:00 1998 Peter Gerwinski <peter@gerwinski.de>
+
+ * expr.c (get_inner_reference): convert `index' to `sbitsizetype'
+ or `ssizetype' to ensure that the product or sum gets this type.
+
Mon Aug 24 01:21:38 PDT 1998 Jeff Law (law@cygnus.com)
* version.c: Bump for snapshot.
*** expr.c.orig Fri Aug 28 14:33:30 1998
--- expr.c Fri Aug 28 14:40:52 1998
*************** get_inner_reference (exp, pbitsize, pbit
*** 4558,4564 ****
index_type = TREE_TYPE (index);
}
! xindex = fold (build (MULT_EXPR, sbitsizetype, index,
convert (sbitsizetype,
TYPE_SIZE (TREE_TYPE (exp)))));
--- 4558,4565 ----
index_type = TREE_TYPE (index);
}
! xindex = fold (build (MULT_EXPR, sbitsizetype,
! convert (sbitsizetype, index),
convert (sbitsizetype,
TYPE_SIZE (TREE_TYPE (exp)))));
*************** get_inner_reference (exp, pbitsize, pbit
*** 4571,4577 ****
it overflowed. In either case, redo the multiplication
against the size in units. This is especially important
in the non-constant case to avoid a division at runtime. */
! xindex = fold (build (MULT_EXPR, ssizetype, index,
convert (ssizetype,
TYPE_SIZE_UNIT (TREE_TYPE (exp)))));
--- 4572,4579 ----
it overflowed. In either case, redo the multiplication
against the size in units. This is especially important
in the non-constant case to avoid a division at runtime. */
! xindex = fold (build (MULT_EXPR, ssizetype,
! convert (ssizetype, index),
convert (ssizetype,
TYPE_SIZE_UNIT (TREE_TYPE (exp)))));