Fix crash with GNAT minimal encodings
authorTom Tromey <tromey@adacore.com>
Thu, 15 Apr 2021 14:54:06 +0000 (08:54 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 30 Apr 2021 13:33:01 +0000 (07:33 -0600)
commit2869ac4b59d58caf736f216f7bc65377116bd5f7
tree41800bc393f05104e2e55de0cbaf48a3d0394b4f
parentd1fbc3ba09fb2e79acf633df29ccbe9285624419
Fix crash with GNAT minimal encodings

Running the AdaCore internal test suite with -fgnat-encodings=minimal
found a gdb crash.  The bug is that GDB ends up with a typedef in
ada_index_type, resulting in a NULL dereference.

This crash can be reproduced using GCC 11 with the included test case.

Tested on x86-64 Fedora 32.  Because this is Ada-specific, and was
already reviewed by Joel, I am going to check it in.

2021-04-30  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (ada_index_type): Use ada_check_typedef.

gdb/testsuite/ChangeLog
2021-04-30  Tom Tromey  <tromey@adacore.com>

* gdb.ada/enum_idx_packed/pck.ads (My_Enum, My_Array_Type)
(Confused_Array): New types.
* gdb.ada/enum_idx_packed/foo.adb (Confused_Array): New variable.
* gdb.ada/enum_idx_packed.exp: Add new tests.
gdb/ChangeLog
gdb/ada-lang.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/enum_idx_packed.exp
gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb
gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads