]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix bugs in 'val and 'pos with range types
authorTom Tromey <tromey@adacore.com>
Tue, 26 May 2020 20:11:08 +0000 (14:11 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 26 May 2020 20:11:08 +0000 (14:11 -0600)
commit0bc2354b811e913b39c288e74d7166eaa3639309
treee807e4fde40111f355fd7605933120fe13e3d52c
parent0db49895f30daea6edcc57e4c5003fd02a747c2b
Fix bugs in 'val and 'pos with range types

In Ada, the 'val and 'pos attributes can be used to map from an
enumeration constant to its position in the enum and vice versa.
These operators did not work properly when the type in question was a
subrange of an enum type with "holes".

gdb/ChangeLog
2020-05-26  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (value_val_atr): Handle TYPE_CODE_RANGE.
* gdbtypes.c (discrete_position): Handle TYPE_CODE_RANGE.

gdb/testsuite/ChangeLog
2020-05-26  Tom Tromey  <tromey@adacore.com>

* gdb.ada/arr_acc_idx_w_gap.exp: Add enum subrange tests.
* gdb.ada/arr_acc_idx_w_gap/enum_with_gap.ads (Enum_Subrange): New
type.
* gdb.ada/arr_acc_idx_w_gap/enum_with_gap_main.adb (V): New
variable.
gdb/ChangeLog
gdb/ada-lang.c
gdb/gdbtypes.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp
gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap.ads
gdb/testsuite/gdb.ada/arr_acc_idx_w_gap/enum_with_gap_main.adb