]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Handle enumerators in name associations in Ada
authorTom Tromey <tromey@adacore.com>
Wed, 11 Feb 2026 22:05:26 +0000 (15:05 -0700)
committerTom Tromey <tromey@adacore.com>
Thu, 12 Feb 2026 21:34:24 +0000 (14:34 -0700)
commitaf67bb32a24bf26287568ce5069d8e12be6579ec
treec57c475080e9bf3ab0b1f627ff80c9204321df02
parent4f13feb6044200ee2d195a5f2bdb194535e1f28b
Handle enumerators in name associations in Ada

assoc.exp does this:

    print pck.value := (Left => 3, Center => 7, Pck.Right => 2)

However, the test case is constructed so that "Center" has multiple
meanings: it might name the enumerator here:

    type Posn is (Left, Center, Right);

or it might refer to this variable:

   Center : Pck.Posn := Pck.Right;

The correct answer in this case is to pick the enumerator, because
that is the array's index type.

Originally I didn't fix this problem and instead used a kfail.
However, this same problem turned up again (in a slightly different
form) when the libgnat debuginfo was installed.

This patch fixes the bug by introducing new code in
ada_name_association::assign to handle the enumeration case.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33896
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33898
Tested-By: Tom de Vries <tdevries@suse.de>
gdb/ada-lang.c
gdb/testsuite/gdb.ada/assoc.exp