* ada-valprint.c (print_optional_low_bound): Handle properly
cases where the array index type is a TYPE_CODE_RANGE.
This commit is contained in:
parent
168de233a7
commit
fd1b946ec5
2 changed files with 16 additions and 1 deletions
|
@ -1,4 +1,9 @@
|
||||||
2005-10-05 Joel Brobecker <brobecker@adacore.com>
|
2005-10-09 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
|
* 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 <brobecker@adacore.com>
|
||||||
|
|
||||||
* valprint.c (val_print_array_elements): Check array size before
|
* valprint.c (val_print_array_elements): Check array size before
|
||||||
computing its low bound. If zero, then use a default bound of zero.
|
computing its low bound. If zero, then use a default bound of zero.
|
||||||
|
|
|
@ -94,6 +94,16 @@ print_optional_low_bound (struct ui_file *stream, struct type *type)
|
||||||
|
|
||||||
index_type = TYPE_INDEX_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))
|
switch (TYPE_CODE (index_type))
|
||||||
{
|
{
|
||||||
case TYPE_CODE_ENUM:
|
case TYPE_CODE_ENUM:
|
||||||
|
|
Loading…
Add table
Reference in a new issue