Index: gdb/eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.139
diff -c -p -r1.139 eval.c
*** gdb/eval.c	11 Aug 2010 16:48:26 -0000	1.139
--- gdb/eval.c	16 Sep 2010 07:54:41 -0000
*************** evaluate_subexp_standard (struct type *e
*** 2306,2321 ****
  
  	    subscript_array[nargs - i - 1] -= lower;
  
! 	    /* If we are at the bottom of a multidimensional 
! 	       array type then keep a ptr to the last ARRAY
! 	       type around for use when calling value_subscript()
! 	       below. This is done because we pretend to value_subscript
! 	       that we actually have a one-dimensional array 
! 	       of base element type that we apply a simple 
! 	       offset to. */
! 
! 	    if (i < nargs - 1)
! 	      tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type));
  	  }
  
  	/* Now let us calculate the offset for this item */
--- 2306,2312 ----
  
  	    subscript_array[nargs - i - 1] -= lower;
  
! 	    tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type));
  	  }
  
  	/* Now let us calculate the offset for this item */
*************** evaluate_subexp_standard (struct type *e
*** 2326,2339 ****
  	  offset_item =
  	    array_size_array[i - 1] * offset_item + subscript_array[i - 1];
  
- 	/* Let us now play a dirty trick: we will take arg1 
- 	   which is a value node pointing to the topmost level
- 	   of the multidimensional array-set and pretend
- 	   that it is actually a array of the final element 
- 	   type, this will ensure that value_subscript()
- 	   returns the correct type value */
- 
- 	deprecated_set_value_type (arg1, tmp_type);
  	return value_subscripted_rvalue (arg1, offset_item, 0);
        }
  
--- 2317,2322 ----
Index: gdb/valarith.c
===================================================================
RCS file: /cvs/src/src/gdb/valarith.c,v
retrieving revision 1.86
diff -c -p -r1.86 valarith.c
*** gdb/valarith.c	11 Aug 2010 16:48:26 -0000	1.86
--- gdb/valarith.c	16 Sep 2010 07:54:42 -0000
*************** struct value *
*** 193,202 ****
  value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
  {
    struct type *array_type = check_typedef (value_type (array));
!   struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
!   unsigned int elt_size = TYPE_LENGTH (elt_type);
!   unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
    struct value *v;
  
    if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
  			     && elt_offs >= TYPE_LENGTH (array_type)))
--- 193,211 ----
  value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
  {
    struct type *array_type = check_typedef (value_type (array));
!   struct type *elt_type = array_type; 
!   unsigned int elt_size, elt_offs;
    struct value *v;
+   
+   /* Peel of the array indices until we reach the array element type */
+   do {
+     elt_type = TYPE_TARGET_TYPE(elt_type);
+   }
+   while ( TYPE_CODE(elt_type) == TYPE_CODE_ARRAY);
+ 
+   elt_type = check_typedef(elt_type);
+   elt_size = TYPE_LENGTH (elt_type);
+   elt_offs = elt_size * longest_to_int (index - lowerbound);
  
    if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
  			     && elt_offs >= TYPE_LENGTH (array_type)))
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/ChangeLog,v
retrieving revision 1.928
diff -c -p -r1.928 ChangeLog
*** ChangeLog	18 Jul 2010 08:12:39 -0000	1.928
--- ChangeLog	16 Sep 2010 08:00:41 -0000
***************
*** 1,3 ****
--- 1,13 ----
+ 2010-09-16 Andrew Burgess <aburgess@broadcom.com>
+ 
+  	* valarith.c (value_subscripted_rvalue) Walk through
+  	multi-dimensional arrays to find the element type for the
+  	array. Allows the upper bound check to work with multi-dimensional
+  	arrays.
+  	* eval.c (evaluate_subexp_standard) Remove hack from
+  	multi_f77_subscript case now that multi-dimensional arrays are
+  	supported in valarith.c
+ 
  2010-07-17  Jack Howarth  <howarth@bromo.med.uc.edu>
  
  	PR target/44862
