From patchwork Tue Aug 10 17:41:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 61402 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 AB91BB6F07 for ; Wed, 11 Aug 2010 03:42:07 +1000 (EST) Received: (qmail 15040 invoked by alias); 10 Aug 2010 17:42:03 -0000 Received: (qmail 15012 invoked by uid 22791); 10 Aug 2010 17:41:59 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, 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; Tue, 10 Aug 2010 17:41:53 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7AHfqK8022659 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Aug 2010 13:41:52 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7AHfpte010502; Tue, 10 Aug 2010 13:41:51 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o7AHfo7I015806; Tue, 10 Aug 2010 13:41:51 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id A0A633781A0; Tue, 10 Aug 2010 11:41:50 -0600 (MDT) From: Tom Tromey To: gcc-patches@gcc.gnu.org Subject: Patch: fix demangler crash Date: Tue, 10 Aug 2010 11:41:50 -0600 Message-ID: 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 This patch comes from http://sourceware.org/bugzilla/show_bug.cgi?id=11572 The demangler crashes on a certain input; I verified this on the compile farm. With this patch, the demangler does not crash. I also ran test-demangle under valgrind and didn't see any reports. I am not 100% certain that the new output is correct. I would appreciate it if somebody knowledgeable about lambdas could look at this. Ok to commit? Tom 2010-08-10 James Lyon http://sourceware.org/bugzilla/show_bug.cgi?id=11572 * cp-demangle.c (d_find_pack): Add case for DEMANGLE_COMPONENT_LAMBDA. * testsuite/demangle-expected: Add regression test. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index d2d15e9..39c8cc0 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3480,6 +3480,7 @@ d_find_pack (struct d_print_info *dpi, case DEMANGLE_COMPONENT_PACK_EXPANSION: return NULL; + case DEMANGLE_COMPONENT_LAMBDA: case DEMANGLE_COMPONENT_NAME: case DEMANGLE_COMPONENT_OPERATOR: case DEMANGLE_COMPONENT_BUILTIN_TYPE: diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 15a0fe7..0085564 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4052,3 +4052,8 @@ prot.lock.update --format=gnu-v3 DFA DFA +# +# http://sourceware.org/bugzilla/show_bug.cgi?id=11572 +--format=auto +_ZN3Psi7VariantIIcPKcEE5visitIIRZN11VariantTest9TestVisit11test_methodEvEUlS2_E0_RZNS6_11test_methodEvEUlcE1_RZNS6_11test_methodEvEUlNS_4NoneEE_EEENS_13VariantDetail19SelectVisitorResultIIDpT_EE4typeEDpOSG_ +Psi::VariantDetail::SelectVisitorResult::type Psi::Variant::visit((VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&&&)...)