diff mbox

[dwarf] : PR/47209 Segfault in should_emit_struct_debug

Message ID AANLkTikmUdQx7i4gQcPNk+YtCfLqYE0NVEhmkhPGX25P@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Jan. 11, 2011, 9:52 p.m. UTC
2011/1/11 Kai Tietz <ktietz70@googlemail.com>:
> 2011/1/11 H.J. Lu <hjl.tools@gmail.com>:
>> 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.
>>
>>
>> --
>> H.J.
>>

Sorry had a -g in option list, which isn't necessary. Updated patch

ChangeLog for testsuite

         PR debug/47209
         * g++.dg/debug/pr47209.C: New.

Regards,
Kai

Comments

Dave Korn Jan. 11, 2011, 10:24 p.m. UTC | #1
On 11/01/2011 21:52, Kai Tietz wrote:

>>>>          PR debug/47209
>>>>          * dwarfout2.c (should_emit_struct_debug): Use TYPE_MAIN_VARIANT
>>>>          of type.

> -  type_decl = TYPE_STUB_DECL (type);
> +  type_decl = TYPE_STUB_DECL(TYPE_MAIN_VARIANT(type));
                               ^                 ^
  Missing spaces before the open brackets.

    cheers,
      DaveK
diff mbox

Patch

Index: gcc/gcc/dwarf2out.c
===================================================================
--- gcc.orig/gcc/dwarf2out.c	2011-01-11 22:26:26.000000000 +0100
+++ gcc/gcc/dwarf2out.c	2011-01-11 21:57:09.704996700 +0100
@@ -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);
Index: gcc/gcc/testsuite/g++.dg/debug/pr47209.C
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gcc/gcc/testsuite/g++.dg/debug/pr47209.C	2011-01-11 22:50:36.703426500 +0100
@@ -0,0 +1,12 @@ 
+// { dg-do compile }
+// { dg-options "-femit-struct-debug-baseonly" }
+struct A
+{
+  void foo ();
+};
+
+struct B : A
+{
+  typedef const A base;
+  using base::foo;
+};