]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix test in anonymous_struct_prefix
authorTom Tromey <tom@tromey.com>
Sat, 20 Sep 2025 20:02:53 +0000 (14:02 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 20 Sep 2025 20:08:19 +0000 (14:08 -0600)
commit8bbc7f91fc5c59281b4fa790185d7562b20a5e18
treefbfc4d3d57c1ad50e091d0317ef25ddd29c79c4e
parent57389cbcb24efb940a466e85e0cabd897ff3e47e
Fix test in anonymous_struct_prefix

I noticed a bad test in dwarf2/read.c:anonymous_struct_prefix:

   attr = dw2_linkage_name_attr (die, cu);
   const char *attr_name = attr->as_string ();
  if (attr == NULL || attr_name == NULL)
    return NULL;

Here, if attr==NULL, this will crash before the test can be executed.

This patch fixes the problem by hoisting the test.  I'm checking this
in as obvious.
gdb/dwarf2/read.c