Avoid crash in dwarf2_init_complex_target_type
authorTom Tromey <tromey@adacore.com>
Tue, 16 Apr 2019 18:12:09 +0000 (12:12 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 17 Apr 2019 12:55:05 +0000 (06:55 -0600)
commita12e57448ecf2644e3ddc98bbd4bbb914a5f8c92
tree9f2cfe0d210dfcafd777128ba950e1a2f5eea25b
parenta7e559cc087b10b9ea337b58e52cc13964aae3fb
Avoid crash in dwarf2_init_complex_target_type

After commit 35add35 ("gdb: Fix failure in gdb.base/complex-parts.exp
for x86-32"), dwarf2_init_complex_target_type can crash if "tt" is
nullptr.  This patch avoids the problem by checking for this case.

No test case because I don't know a good way to write one; it was
found by an internal AdaCore test case that apparently uses a 16 bit
floating point type.

gdb/ChangeLog:
* dwarf2read.c (dwarf2_init_complex_target_type): Check "tt"
against nullptr before use.

gdb/ChangeLog
2019-04-17  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c (dwarf2_init_complex_target_type): Check "tt"
against nullptr before use.
gdb/ChangeLog
gdb/dwarf2read.c