From patchwork Mon May 21 20:45:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 160474 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 CC8A4B6F13 for ; Tue, 22 May 2012 06:46:42 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1338238003; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: From:To:Subject:CC:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=VGD/kIr1ePmRS27Wmtw/SroFu04=; b=uGBFlNCkznCtYAN WHfIfKDDdSG3s+yuwm1mMNTQAamkKmRa15Nkpw90yQDwkjPBZZtjnH69JUxIV+jd SVjC7CRzPDHvpG4rm3ZAJQlo0QYqiFxw3IPgUD9Qx2c0kJRLqjw/sOOCYL+oIpng jlHB7NIysFgQvoXUeb1FwanSYBr8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:From:To:Subject:CC:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=WPMrNQhWd5YwDYkW/9v3wLa64QEsUVjngQV7+uwSeV6zwKbDF/rwKGHCMoglyA E7+E/3HeKC3cCKH7ua0XdC3LRjEafD1h/BPWwlI/R9cbO+drrEJ1PXVIqVBpQo31 QvoUlG2YCAUTTOmOkGvgmgzTje+OGXAbfVAJ32qDt86CI=; Received: (qmail 6173 invoked by alias); 21 May 2012 20:46:14 -0000 Received: (qmail 6005 invoked by uid 22791); 21 May 2012 20:46:07 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL, BAYES_00, KAM_STOCKTIP, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 May 2012 20:45:49 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4LKjmH7019419 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 21 May 2012 16:45:48 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q4LKjkpK005500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 21 May 2012 16:45:47 -0400 From: Tom Tromey To: gcc-patches@gcc.gnu.org Subject: fix demangler crash - gdb PR 14065 CC: gdb-patches@sourceware.org, Jason Merrill Date: Mon, 21 May 2012 14:45:46 -0600 Message-ID: <87k405e005.fsf@fleche.redhat.com> MIME-Version: 1.0 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 GDB PR 14065 has an executable which causes gdb to crash. It crashes trying to demangle a certain symbol (see the included test case). The standalone demangler doesn't crash here, but you can still see the failure with valgrind. I'm not sure this is the proper fix, but it seemed correct, and it does avoid the crash. Ok? Tom 2012-05-21 Tom Tromey http://sourceware.org/bugzilla/show_bug.cgi?id=14065 * testsuite/demangle-expected: Add regression test. * cp-demangle.c (d_find_pack): Return NULL for DEMANGLE_COMPONENT_UNNAMED_TYPE. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index d95b56c..27cc323 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3715,6 +3715,7 @@ d_find_pack (struct d_print_info *dpi, case DEMANGLE_COMPONENT_SUB_STD: case DEMANGLE_COMPONENT_CHARACTER: case DEMANGLE_COMPONENT_FUNCTION_PARAM: + case DEMANGLE_COMPONENT_UNNAMED_TYPE: return NULL; case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index d489692..58c1368 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4266,3 +4266,7 @@ foo _Z1fIKFvvES0_Evv void f() f +# +--format=gnu-v3 +_ZN4modc6parser8sequenceINS_9astParser13LocatedParserINS0_9ParserRefINS2_UlRNS2_16TokenParserInputEE_EEEEEINS0_14OptionalParserINS2_18ListParserTemplateILNS_6tokens5Token4TypeE4EXadL_ZNSD_Ut_13parenthesizedEEEE6ParserINS4_INS0_6ParserIS5_NS_3ast10ExpressionEEEEEEEEENSA_INS4_INS2_22OneOfKeywordsToTParserINSJ_5StyleEEEEEEENS0_14SequenceParserIS5_INS0_18ExactElementParserIS5_EENSA_ISM_EEEEENS0_14RepeatedParserINS4_INS0_15TransformParserINSU_IS5_INS4_INSP_INSJ_10Annotation12RelationshipEEEEESX_EEENS2_UlNS2_3LocES12_ONS_5MaybeISK_EEE19_EEEEELb0EEEEEENSU_INS0_17ExtractParserTypeIT_E9InputTypeEINS0_8MaybeRefIS1F_E4TypeEDpNS1I_IT0_E4TypeEEEEOS1F_DpOS1L_ +modc::parser::ParserRef::Parser::Style> > > >::InputType, modc::parser::MaybeRef&&)#21}>::Type, modc::parser::RepeatedParser::Parser::Style> >::Parser > >::Parser::Annotation::Relationship> >, modc::parser::ExactElementParser> >, modc::astParser::{lambda(modc::astParser::Loc, modc::parser::RepeatedParser, modc::Maybe&&)#21}> >, false>::Parser > > > >::Type, modc::parser::RepeatedParser::Parser::Style> >::Parser > >::Parser::Annotation::Relationship> >, modc::parser::ExactElementParser> >, modc::astParser::{lambda(modc::astParser::Loc, modc::parser::RepeatedParser, modc::Maybe&&)#21}> >, false> >::Parser::Style> > > >::Type, modc::parser::RepeatedParser::Parser::Style> >::Parser > >::Parser::Annotation::Relationship> >, modc::parser::ExactElementParser> >, modc::astParser::{lambda(modc::astParser::Loc, modc::parser::RepeatedParser, modc::Maybe&&)#21}> >, false>, modc::astParser::LocatedParser > > > >::Type, modc::parser::RepeatedParser::Parser::Style> >::Parser > >::Parser::Annotation::Relationship> >, modc::parser::ExactElementParser> >, modc::astParser::{lambda(modc::astParser::Loc, modc::parser::RepeatedParser, modc::Maybe&&)#21}> >, false>::Parser::Style> >::Parser > >::Parser::Annotation::Relationship> >, modc::parser::ExactElementParser> >, modc::astParser::{lambda(modc::astParser::Loc, modc::parser::RepeatedParser, modc::Maybe&&)#21}> >, false> >::Type> modc::parser::sequence >, modc::parser::OptionalParser::Parser > > >, modc::astParser::LocatedParser >::Parser::Style> > >, modc::parser::SequenceParser, modc::astParser::LocatedParser > > >, modc::parser::RepeatedParser::Parser::Style> >::Parser > >::Parser::Annotation::Relationship> >, modc::parser::ExactElementParser> >, modc::astParser::{lambda(modc::astParser::Loc, modc::parser::RepeatedParser, modc::Maybe&&)#21}> >, false> >(modc::astParser::{lambda(modc::astParser::Loc, modc::parser::RepeatedParser, modc::Maybe&&)#21}&&, (modc::parser::ExtractParserType > >&&)...)