aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-valprint.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2005-10-10 01:05:32 +0000
committerJoel Brobecker <brobecker@gnat.com>2005-10-10 01:05:32 +0000
commitfd1b946ec5e5c17bf7554d7d0edc9ac37f8dc72e (patch)
tree9e7679e5d6070a538b7bf97114ce1764b3687fdb /gdb/ada-valprint.c
parent168de233a78e1a72a4415c3618dba3ff2428f850 (diff)
downloadgdb-fd1b946ec5e5c17bf7554d7d0edc9ac37f8dc72e.zip
gdb-fd1b946ec5e5c17bf7554d7d0edc9ac37f8dc72e.tar.gz
gdb-fd1b946ec5e5c17bf7554d7d0edc9ac37f8dc72e.tar.bz2
* ada-valprint.c (print_optional_low_bound): Handle properly
cases where the array index type is a TYPE_CODE_RANGE.
Diffstat (limited to 'gdb/ada-valprint.c')
-rw-r--r--gdb/ada-valprint.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index a02bf6e..2548a5f 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: