* ada-valprint.c (print_optional_low_bound): Handle properly
[deliverable/binutils-gdb.git] / gdb / ada-valprint.c
index a02bf6e39928f331fe843976a51c76f7fbb63b23..2548a5fe026e83c7a80bf0b146d976db5afe7e6f 100644 (file)
@@ -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:
This page took 0.0444870000000001 seconds and 4 git commands to generate.