1 Re: [PATCH 04/23] vla: make dynamic fortran arrays functional.
2 https://sourceware.org/ml/gdb-patches/2014-06/msg00570.html
4 Index: gdb-7.7.90.20140627/gdb/valarith.c
5 ===================================================================
6 --- gdb-7.7.90.20140627.orig/gdb/valarith.c 2014-07-07 20:44:03.136394525 +0200
7 +++ gdb-7.7.90.20140627/gdb/valarith.c 2014-07-07 20:45:41.588536459 +0200
8 @@ -195,10 +195,17 @@ value_subscripted_rvalue (struct value *
9 struct type *array_type = check_typedef (value_type (array));
10 struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
11 unsigned int elt_size = TYPE_LENGTH (elt_type);
12 - unsigned int elt_offs = longest_to_int (index - lowerbound);
13 + unsigned int elt_offs;
14 LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type));
17 + if (TYPE_NOT_ASSOCIATED (array_type))
18 + error (_("no such vector element because not associated"));
19 + if (TYPE_NOT_ALLOCATED (array_type))
20 + error (_("no such vector element because not allocated"));
22 + elt_offs = longest_to_int (index - lowerbound);
25 elt_offs *= elt_stride;
26 else if (elt_stride < 0)
27 @@ -212,14 +219,7 @@ value_subscripted_rvalue (struct value *
29 if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
30 && elt_offs >= TYPE_LENGTH (array_type)))
32 - if (TYPE_NOT_ASSOCIATED (array_type))
33 - error (_("no such vector element because not associated"));
34 - else if (TYPE_NOT_ALLOCATED (array_type))
35 - error (_("no such vector element because not allocated"));
37 - error (_("no such vector element"));
39 + error (_("no such vector element"));
41 if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
42 v = allocate_value_lazy (elt_type);