From patchwork Tue Jan 11 21:52:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 78448 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8DE08B6EF2 for ; Wed, 12 Jan 2011 08:52:58 +1100 (EST) Received: (qmail 1461 invoked by alias); 11 Jan 2011 21:52:57 -0000 Received: (qmail 1451 invoked by uid 22791); 11 Jan 2011 21:52:56 -0000 X-SWARE-Spam-Status: No, hits=0.3 required=5.0 tests=AWL, BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-qy0-f175.google.com (HELO mail-qy0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Jan 2011 21:52:51 +0000 Received: by qyk8 with SMTP id 8so3172994qyk.20 for ; Tue, 11 Jan 2011 13:52:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.192.149 with SMTP id dq21mr138206qcb.57.1294782769179; Tue, 11 Jan 2011 13:52:49 -0800 (PST) Received: by 10.229.214.131 with HTTP; Tue, 11 Jan 2011 13:52:49 -0800 (PST) In-Reply-To: References: Date: Tue, 11 Jan 2011 22:52:49 +0100 Message-ID: Subject: Re: [patch dwarf]: PR/47209 Segfault in should_emit_struct_debug From: Kai Tietz To: "H.J. Lu" Cc: GCC Patches , Jason Merrill X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 2011/1/11 Kai Tietz : > 2011/1/11 H.J. Lu : >> On Tue, Jan 11, 2011 at 12:58 PM, Kai Tietz 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 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; +};