SUBREG GIVs - Suggestion for a quick hack.

Richard Henderson rth@cygnus.com
Wed Oct 1 17:53:00 GMT 1997


> I first thought this was caused by the following code in expr.c (line 4350):
> 
>           if (TYPE_PRECISION (index_type) != TYPE_PRECISION (sizetype))
>             {
>               index = convert (type_for_size (TYPE_PRECISION (sizetype), 0),
>                                index);
>               index_type = TREE_TYPE (index);
>             }

Hah.  Good eyes.  It is that bit of code.  It is needed, yes, but
it needs to be done earlier, before the array index bias is removed.


r~



Wed Oct  1 17:47:48 1997  Richard Henderson  <rth@cygnus.com>

	* expr.c (get_inner_reference): Remove the array bias after 
	converting the index to Pmode.
	

Index: expr.c
===================================================================
RCS file: /cvs/cvsfiles/egcs/gcc/expr.c,v
retrieving revision 1.10
diff -u -p -d -r1.10 expr.c
--- expr.c	1997/09/22 17:41:29	1.10
+++ expr.c	1997/10/02 00:48:20
@@ -4344,15 +4344,15 @@ get_inner_reference (exp, pbitsize, pbit
 	    = domain ? TYPE_MIN_VALUE (domain) : integer_zero_node;
 	  tree index_type = TREE_TYPE (index);
 
-	  if (! integer_zerop (low_bound))
-	    index = fold (build (MINUS_EXPR, index_type, index, low_bound));
-
 	  if (TYPE_PRECISION (index_type) != TYPE_PRECISION (sizetype))
 	    {
 	      index = convert (type_for_size (TYPE_PRECISION (sizetype), 0),
 			       index);
 	      index_type = TREE_TYPE (index);
 	    }
+
+	  if (! integer_zerop (low_bound))
+	    index = fold (build (MINUS_EXPR, index_type, index, low_bound));
 
 	  index = fold (build (MULT_EXPR, index_type, index,
 			       convert (index_type,



More information about the Gcc mailing list