From patchwork Tue Jan 11 21:36:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 78447 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 2B278B6EED for ; Wed, 12 Jan 2011 08:36:29 +1100 (EST) Received: (qmail 15813 invoked by alias); 11 Jan 2011 21:36:27 -0000 Received: (qmail 15662 invoked by uid 22791); 11 Jan 2011 21:36:26 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL, BAYES_00, 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-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Jan 2011 21:36:21 +0000 Received: by qwi2 with SMTP id 2so5500093qwi.20 for ; Tue, 11 Jan 2011 13:36:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.235.2 with SMTP id ke2mr85078qcb.285.1294781779522; Tue, 11 Jan 2011 13:36:19 -0800 (PST) Received: by 10.229.214.131 with HTTP; Tue, 11 Jan 2011 13:36:19 -0800 (PST) In-Reply-To: References: Date: Tue, 11 Jan 2011 22:36:19 +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 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. > Yes, missed that. 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:30:44.711248500 +0100 @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-options "-femit-struct-debug-baseonly -g" } +struct A +{ + void foo (); +}; + +struct B : A +{ + typedef const A base; + using base::foo; +};