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