Message ID | AANLkTimEo-nNaXbcpbzAjEWKVSRTnyW17Ruu5jtuXikO@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Tue, Jan 11, 2011 at 12:58 PM, Kai Tietz <ktietz70@googlemail.com> wrote: > Hello, > > following patch fixes reported segfault at > > ChangeLog > > 2011-01-11 Kai Tietz > > PR debug/47209 > * dwarfout2.c (should_emit_struct_debug): Use TYPE_MAIN_VARIANT > of type. > > Tested for x86_64-pc-linux-gnu and x86_64-pc-mingw32. Ok for apply? > You need to add testcases.
On Tue, Jan 11, 2011 at 9:58 PM, Kai Tietz <ktietz70@googlemail.com> wrote: > Hello, > > following patch fixes reported segfault at > > ChangeLog > > 2011-01-11 Kai Tietz > > PR debug/47209 > * dwarfout2.c (should_emit_struct_debug): Use TYPE_MAIN_VARIANT > of type. > > Tested for x86_64-pc-linux-gnu and x86_64-pc-mingw32. Ok for apply? > > Regards, > Kai > > -- > > Index: dwarf2out.c > =================================================================== > --- dwarf2out.c (revision 168679) > +++ dwarf2out.c (working copy) > @@ -619,7 +619,7 @@ > if (criterion == DINFO_STRUCT_FILE_ANY) > return DUMP_GSTRUCT (type, usage, criterion, generic, false, true); > > - type_decl = TYPE_STUB_DECL (type); > + type_decl = TYPE_STUB_DECL(TYPE_MAIN_VARIANT(type)); Why? That will go to the non-type-decl variant, so it seems wrong. Richard. > > if (criterion == DINFO_STRUCT_FILE_SYS && DECL_IN_SYSTEM_HEADER (type_decl)) > return DUMP_GSTRUCT (type, usage, criterion, generic, false, true); >
On 01/12/2011 05:04 AM, Richard Guenther wrote: >> - type_decl = TYPE_STUB_DECL (type); >> + type_decl = TYPE_STUB_DECL(TYPE_MAIN_VARIANT(type)); > > Why? That will go to the non-type-decl variant, so it seems wrong. TYPE_STUB_DECL only makes sense on the primary variant of a struct. cv-qualified or typedef variants don't have the stub decl, which is why the testcase was crashing. The patch is OK with the whitespace fix Dave pointed out. Jason
2011/1/12 Jason Merrill <jason@redhat.com>: > On 01/12/2011 05:04 AM, Richard Guenther wrote: >>> >>> - type_decl = TYPE_STUB_DECL (type); >>> + type_decl = TYPE_STUB_DECL(TYPE_MAIN_VARIANT(type)); >> >> Why? That will go to the non-type-decl variant, so it seems wrong. > > TYPE_STUB_DECL only makes sense on the primary variant of a struct. > cv-qualified or typedef variants don't have the stub decl, which is why the > testcase was crashing. > > The patch is OK with the whitespace fix Dave pointed out. > > Jason > Applied with whitespace fix at revision 168718 to trunk. Thanks, Kai
Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 168679) +++ dwarf2out.c (working copy) @@ -619,7 +619,7 @@ if (criterion == DINFO_STRUCT_FILE_ANY) return DUMP_GSTRUCT (type, usage, criterion, generic, false, true); - type_decl = TYPE_STUB_DECL (type); + type_decl = TYPE_STUB_DECL(TYPE_MAIN_VARIANT(type)); if (criterion == DINFO_STRUCT_FILE_SYS && DECL_IN_SYSTEM_HEADER (type_decl)) return DUMP_GSTRUCT (type, usage, criterion, generic, false, true);