2014-06-19 20:14:32 +00:00
|
|
|
Re: [PATCH 04/23] vla: make dynamic fortran arrays functional.
|
|
|
|
https://sourceware.org/ml/gdb-patches/2014-06/msg00570.html
|
|
|
|
|
2015-11-03 21:28:36 +00:00
|
|
|
Index: gdb-7.10.50.20151027/gdb/valarith.c
|
2014-06-19 20:14:32 +00:00
|
|
|
===================================================================
|
2015-11-03 21:28:36 +00:00
|
|
|
--- 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 *
|
2014-06-19 20:14:32 +00:00
|
|
|
struct type *array_type = check_typedef (value_type (array));
|
|
|
|
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
|
2015-11-03 21:28:36 +00:00
|
|
|
unsigned int elt_size = type_length_units (elt_type);
|
2014-07-08 19:11:05 +00:00
|
|
|
- unsigned int elt_offs = longest_to_int (index - lowerbound);
|
2014-06-19 20:14:32 +00:00
|
|
|
+ unsigned int elt_offs;
|
2014-07-08 19:11:05 +00:00
|
|
|
LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type));
|
2014-06-19 20:14:32 +00:00
|
|
|
struct value *v;
|
|
|
|
|
|
|
|
+ if (TYPE_NOT_ASSOCIATED (array_type))
|
2015-11-03 21:28:36 +00:00
|
|
|
+ error (_("no such vector element (vector not associated)"));
|
2014-06-19 20:14:32 +00:00
|
|
|
+ if (TYPE_NOT_ALLOCATED (array_type))
|
2015-11-03 21:28:36 +00:00
|
|
|
+ error (_("no such vector element (vector not allocated)"));
|
2014-06-19 20:14:32 +00:00
|
|
|
+
|
2014-07-08 19:11:05 +00:00
|
|
|
+ elt_offs = longest_to_int (index - lowerbound);
|
2014-06-19 20:14:32 +00:00
|
|
|
+
|
2014-07-08 19:11:05 +00:00
|
|
|
if (elt_stride > 0)
|
|
|
|
elt_offs *= elt_stride;
|
|
|
|
else if (elt_stride < 0)
|
2015-11-03 21:28:36 +00:00
|
|
|
@@ -210,14 +217,7 @@ value_subscripted_rvalue (struct value *
|
2014-07-08 19:11:05 +00:00
|
|
|
|
2014-06-19 20:14:32 +00:00
|
|
|
if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
|
2015-11-03 21:28:36 +00:00
|
|
|
&& elt_offs >= type_length_units (array_type)))
|
2014-06-19 20:14:32 +00:00
|
|
|
- {
|
2015-11-03 21:28:36 +00:00
|
|
|
- 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)"));
|
2014-06-19 20:14:32 +00:00
|
|
|
- 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);
|