From: Joel Brobecker Date: Mon, 10 Oct 2005 01:05:32 +0000 (+0000) Subject: * ada-valprint.c (print_optional_low_bound): Handle properly X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fd1b946ec5e5c17bf7554d7d0edc9ac37f8dc72e;p=binutils-gdb.git * ada-valprint.c (print_optional_low_bound): Handle properly cases where the array index type is a TYPE_CODE_RANGE. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c0f89fd8107..666fd793c37 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,9 @@ -2005-10-05 Joel Brobecker +2005-10-09 Joel Brobecker + + * ada-valprint.c (print_optional_low_bound): Handle properly + cases where the array index type is a TYPE_CODE_RANGE. + +2005-10-09 Joel Brobecker * valprint.c (val_print_array_elements): Check array size before computing its low bound. If zero, then use a default bound of zero. diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index a02bf6e3992..2548a5fe026 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -94,6 +94,16 @@ print_optional_low_bound (struct ui_file *stream, struct type *type) index_type = TYPE_INDEX_TYPE (type); + if (TYPE_CODE (index_type) == TYPE_CODE_RANGE) + { + /* We need to know what the base type is, in order to do the + appropriate check below. Otherwise, if this is a subrange + of an enumerated type, where the underlying value of the + first element is typically 0, we might test the low bound + against the wrong value. */ + index_type = TYPE_TARGET_TYPE (index_type); + } + switch (TYPE_CODE (index_type)) { case TYPE_CODE_ENUM: