From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15631 invoked by alias); 30 May 2014 18:05:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 15618 invoked by uid 89); 30 May 2014 18:05:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oa0-f41.google.com Received: from mail-oa0-f41.google.com (HELO mail-oa0-f41.google.com) (209.85.219.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 30 May 2014 18:05:16 +0000 Received: by mail-oa0-f41.google.com with SMTP id m1so2250995oag.0 for ; Fri, 30 May 2014 11:05:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ls0t7lCRcDBABvCAGgqf80GUaHgVIPCciL7yujZMF8o=; b=aXzD74sOBO6To1RGf5esTryKCSu86d/SEeixjJCgWpSJ+hMDgtxRUnlbswfQDTYlvo B1XMRBNUtQT7x+jjGHnzveLb+Jbxb2dWeTIwEOCPX1Y+24np+JnfD/UusB9+8Be76K3E Vruk8MR7SoQsr7eTxVGkuUE1zaRkKnbJIgxRYHEDA6VRiP29yM45rBsUwaAtZvL4GlqX nL8tC1etvQjoUAQikBO3yAQssu/1gFLvbDHnlrq2+pabNb5FwO7mFk7CaQ2MjvOok5M4 P2qu1PiV3Uo1BovuNx0PjX+nu7/PRkB98+jL2aqXXNgtpFJ31jvUUofTOABpJfGT2fjO ny2w== X-Gm-Message-State: ALoCoQmmRLS8XGCQnQX8SjTDdiVUc+l+HdzdRKyC6dfQAgiM+5vzgwz8BAURyfiHEqvDDI+nrzDf MIME-Version: 1.0 X-Received: by 10.182.27.70 with SMTP id r6mr19501426obg.9.1401473114283; Fri, 30 May 2014 11:05:14 -0700 (PDT) Received: by 10.60.39.195 with HTTP; Fri, 30 May 2014 11:05:14 -0700 (PDT) In-Reply-To: References: <1401191856-27585-1-git-send-email-palves@redhat.com> <1401191856-27585-3-git-send-email-palves@redhat.com> Date: Fri, 30 May 2014 18:05:00 -0000 Message-ID: Subject: Re: [PATCH 2/3] PR other/61321 - demangler crash on casts in template parameters From: Ian Lance Taylor To: Cary Coutant , Jason Merrill Cc: Pedro Alves , gcc-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg02643.txt.bz2 On Fri, May 30, 2014 at 10:37 AM, Cary Coutant wrote: >> Fix this by adding a new DEMANGLE_COMPONENT_CONVERSION component type, >> which does what DEMANGLE_COMPONENT_CAST does today, and making >> DEMANGLE_COMPONENT_CAST just simply print its component subtree. >> >> I think we could instead reuse DEMANGLE_COMPONENT_CAST and in >> d_print_comp_inner still do: >> >> @@ -5001,9 +5013,9 @@ d_print_comp_inner (struct d_print_info *dpi, int options, >> d_print_comp (dpi, options, dc->u.s_extended_operator.name); >> return; >> >> case DEMANGLE_COMPONENT_CAST: >> d_append_string (dpi, "operator "); >> - d_print_cast (dpi, options, dc); >> + d_print_conversion (dpi, options, dc); >> return; >> >> leaving the unary cast case below calling d_print_cast, but seems to >> me that spliting the component types makes it easier to reason about >> the code. > > I agree. > >> libiberty/ >> 2014-05-27 Pedro Alves >> >> PR other/61321 >> PR other/61233 >> * demangle.h (enum demangle_component_type) >> : New value. >> * cp-demangle.c (d_demangle_callback, d_make_comp): Handle >> DEMANGLE_COMPONENT_CONVERSION. >> (is_ctor_dtor_or_conversion): Handle DEMANGLE_COMPONENT_CONVERSION >> instead of DEMANGLE_COMPONENT_CAST. >> (d_operator_name): Return a DEMANGLE_COMPONENT_CONVERSION >> component if handling a conversion. >> (d_count_templates_scopes, d_print_comp_inner): Handle >> DEMANGLE_COMPONENT_CONVERSION. >> (d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION instead >> of DEMANGLE_COMPONENT_CAST. >> (d_print_cast): Rename as ... >> (d_print_conversion): ... this. Adjust comments. >> (d_print_cast): Rewrite - simply print the left subcomponent. >> * cp-demint.c (cplus_demangle_fill_component): Handle >> DEMANGLE_COMPONENT_CONVERSION. >> >> * testsuite/demangle-expected: Add tests. > > Looks good to me. Thanks! > > Ian, does this look good to you? I tend to defer to Jason on this sort of newfangled mangling nuttiness, but I can take a look if he doesn't have time. Ian