[PATCH] gdb: work around negative DW_AT_data_member_location GCC 11 bug

Keith Seitz keiths@redhat.com
Wed Jan 26 18:30:52 GMT 2022


On 1/26/22 10:17, Keith Seitz via Gdb-patches wrote:
> On 1/26/22 09:45, Simon Marchi via Gdb-patches wrote:
>>> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
>>> index 737d8a4c81b..0c66a6daf97 100644
>>> --- a/gdb/dwarf2/read.c
>>> +++ b/gdb/dwarf2/read.c
>>> @@ -14489,6 +14489,16 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
>>>         if (attr->form_is_constant ())
>>>       {
>>>         LONGEST offset = attr->constant_value (0);
>>> +
>>> +      /* Work around this GCC 11 bug, where it would erroneously use -1
>>> +         data member locations, instead of 0:
>>> +
>>> +           Negative DW_AT_data_member_location
>>> +           https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101378
>>> +         */
>>> +      if (offset == -1)
>>> +        offset = 0;
>>> +

I apologize, I forgot to ask: would the more general " < 0" be
appropriate to catch other related bugs, such as fuzzing?

Keith



More information about the Gdb-patches mailing list