Jan Kratochvil eb6cb2d
Re: [PATCH 04/23] vla: make dynamic fortran arrays functional.
Jan Kratochvil eb6cb2d
https://sourceware.org/ml/gdb-patches/2014-06/msg00570.html
Jan Kratochvil eb6cb2d
Jan Kratochvil 23f398e
Index: gdb-7.10.50.20151027/gdb/valarith.c
Jan Kratochvil eb6cb2d
===================================================================
Jan Kratochvil 23f398e
--- gdb-7.10.50.20151027.orig/gdb/valarith.c	2015-11-03 20:41:48.543504999 +0100
Jan Kratochvil 23f398e
+++ gdb-7.10.50.20151027/gdb/valarith.c	2015-11-03 20:46:36.995238888 +0100
Jan Kratochvil 23f398e
@@ -193,10 +193,17 @@ value_subscripted_rvalue (struct value *
Jan Kratochvil eb6cb2d
   struct type *array_type = check_typedef (value_type (array));
Jan Kratochvil eb6cb2d
   struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
Jan Kratochvil 23f398e
   unsigned int elt_size = type_length_units (elt_type);
Jan Kratochvil cec9297
-  unsigned int elt_offs = longest_to_int (index - lowerbound);
Jan Kratochvil eb6cb2d
+  unsigned int elt_offs;
Jan Kratochvil cec9297
   LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type));
Jan Kratochvil eb6cb2d
   struct value *v;
Jan Kratochvil eb6cb2d
 
Jan Kratochvil eb6cb2d
+  if (TYPE_NOT_ASSOCIATED (array_type))
Jan Kratochvil 23f398e
+    error (_("no such vector element (vector not associated)"));
Jan Kratochvil eb6cb2d
+  if (TYPE_NOT_ALLOCATED (array_type))
Jan Kratochvil 23f398e
+    error (_("no such vector element (vector not allocated)"));
Jan Kratochvil eb6cb2d
+
Jan Kratochvil cec9297
+  elt_offs = longest_to_int (index - lowerbound);
Jan Kratochvil eb6cb2d
+
Jan Kratochvil cec9297
   if (elt_stride > 0)
Jan Kratochvil cec9297
     elt_offs *= elt_stride;
Jan Kratochvil cec9297
   else if (elt_stride < 0)
Jan Kratochvil 23f398e
@@ -210,14 +217,7 @@ value_subscripted_rvalue (struct value *
Jan Kratochvil cec9297
 
Jan Kratochvil eb6cb2d
   if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
Jan Kratochvil 23f398e
 			     && elt_offs >= type_length_units (array_type)))
Jan Kratochvil eb6cb2d
-    {
Jan Kratochvil 23f398e
-      if (type_not_associated (array_type))
Jan Kratochvil 23f398e
-        error (_("no such vector element (vector not associated)"));
Jan Kratochvil 23f398e
-      else if (type_not_allocated (array_type))
Jan Kratochvil 23f398e
-        error (_("no such vector element (vector not allocated)"));
Jan Kratochvil eb6cb2d
-      else
Jan Kratochvil eb6cb2d
-        error (_("no such vector element"));
Jan Kratochvil eb6cb2d
-    }
Jan Kratochvil eb6cb2d
+    error (_("no such vector element"));
Jan Kratochvil eb6cb2d
 
Jan Kratochvil eb6cb2d
   if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
Jan Kratochvil eb6cb2d
     v = allocate_value_lazy (elt_type);