gdb/gdb-vla-intel-04of23-fix.patch

37 lines
1.6 KiB
Diff
Raw Normal View History

Re: [PATCH 04/23] vla: make dynamic fortran arrays functional.
https://sourceware.org/ml/gdb-patches/2014-06/msg00570.html
Index: gdb-7.7.90.20140613/gdb/valarith.c
===================================================================
--- gdb-7.7.90.20140613.orig/gdb/valarith.c 2014-06-16 23:16:48.129164644 +0200
+++ gdb-7.7.90.20140613/gdb/valarith.c 2014-06-16 23:17:52.544225452 +0200
@@ -195,19 +195,19 @@ 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 (elt_type);
- unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
+ unsigned int elt_offs;
struct value *v;
+ if (TYPE_NOT_ASSOCIATED (array_type))
+ error (_("no such vector element because not associated"));
+ if (TYPE_NOT_ALLOCATED (array_type))
+ error (_("no such vector element because not allocated"));
+
+ 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)))
- {
- if (TYPE_NOT_ASSOCIATED (array_type))
- error (_("no such vector element because not associated"));
- else if (TYPE_NOT_ALLOCATED (array_type))
- error (_("no such vector element because 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);