From patchwork Sat Aug 15 13:23:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 507631 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2B9CE14018C for ; Sat, 15 Aug 2015 23:23:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=yR4L9l6u; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=L/f6xgk0U/MxEM/HTl6AfxHaarkwNM+FfWbqu0HD4SQeHg 5yu/a9LigvdlS0mIA4SiyTzegJeUtdItZ37+ACkG+6FKwboN9r6hfkdranL6YLPR V1HrXXwgUS3kIRwPgFh8pmILEFSuqF1ZLkMOymkTiyJudsORV9fuE4PgGCCBU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=zUlpXMcZ/UizCUyZN2aopa9BDdM=; b=yR4L9l6uxIUGstqUC/RY 7LW/ZwTkEnsdFViiuS5NjKX5VcYicTXEXsOYzTtzmd1mnrPNxSK9eKBPZ8xLAhXk Xzg8u31OLK0Fh3SMTS2TaAesx5SEQHvaPsbirdjcV/829Gcwan1OIRLeiHLM1WNV RPF9QbW9OglGrSvwQvkgbi8= Received: (qmail 113938 invoked by alias); 15 Aug 2015 13:23:35 -0000 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 Received: (qmail 113929 invoked by uid 89); 15 Aug 2015 13:23:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ig0-f173.google.com Received: from mail-ig0-f173.google.com (HELO mail-ig0-f173.google.com) (209.85.213.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 15 Aug 2015 13:23:33 +0000 Received: by igbjg10 with SMTP id jg10so28576959igb.0 for ; Sat, 15 Aug 2015 06:23:31 -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:date:message-id:subject:from:to :content-type; bh=1vCpwCrC6pKl4pFSnkpcQV+w1aFSq72pQalFctn84VI=; b=NbnUzOnvkjRqVRUFJ4G66IZSPenbg4XlowGpsgw0PieuKs87paYcau29hffW9ERSvE vnDT8J22noch5N7Z7oEG1Kn9BKlIWeOJwx5YBbstDKVGuaTxmgH2SUbdJtxNkCv3dxkC su3q60sDKHw9nIYjOEaBJ1oUeqskz2XZpFYAvCRkwRkr2u/waBXxqpE3eYQlUeo1EidY l5fZ+fVDeH7vlVFyy9VW1FU4ui8Bv0gv4PdL7seM014h3wOH3FIeq3KA57TNPlz+dDad vUokuu/IIhGNG/7y2SA1xrd+E8lTqjdyD5lTlFKmscKlyr/e2QtYX3kNg7clexa/7sOV ZBtA== X-Gm-Message-State: ALoCoQlr0cQA0ub+ykgfGRjpudTanoabHgmyED4n7X1V+NNpv8Awaw6ct/KhAZojBKH9mWaygZte MIME-Version: 1.0 X-Received: by 10.50.111.164 with SMTP id ij4mr7614967igb.70.1439645011654; Sat, 15 Aug 2015 06:23:31 -0700 (PDT) Received: by 10.79.102.133 with HTTP; Sat, 15 Aug 2015 06:23:31 -0700 (PDT) Date: Sat, 15 Aug 2015 06:23:31 -0700 Message-ID: Subject: Demangler patch committed: Fix constructor names with ABI tags From: Ian Lance Taylor To: gcc-patches The symbol _ZNSt8ios_base7failureB5cxx11C1EPKcRKSt10error_code, which appears in libstdc++, was being demangled as std::ios_base::failure[abi:cxx11]::cxx11(char const*, std::error_code const&) That is clearly incorrect: std::ios_base::failure does not have a method cxx11, and anyhow if you look closely at the mangled name you will see that it is supposed to be a constructor. This patch fixes the demangler to generate the correct demangling, namely std::ios_base::failure[abi:cxx11]::failure(char const*, std::error_code const&) Bootstrapped and ran libiberty and libstdc++-v3 tests on x86_64-unknown-linux-gnu. Committed to mainline. Ian 2015-08-15 Ian Lance Taylor * cp-demangle.c (d_abi_tags): Preserve di->last_name across any ABI tags. Index: cp-demangle.c =================================================================== --- cp-demangle.c (revision 226846) +++ cp-demangle.c (working copy) @@ -1306,7 +1306,12 @@ d_encoding (struct d_info *di, int top_l static struct demangle_component * d_abi_tags (struct d_info *di, struct demangle_component *dc) { + struct demangle_component *hold_last_name; char peek; + + /* Preserve the last name, so the ABI tag doesn't clobber it. */ + hold_last_name = di->last_name; + while (peek = d_peek_char (di), peek == 'B') { @@ -1315,6 +1320,9 @@ d_abi_tags (struct d_info *di, struct de tag = d_source_name (di); dc = d_make_comp (di, DEMANGLE_COMPONENT_TAGGED_NAME, dc, tag); } + + di->last_name = hold_last_name; + return dc; } Index: testsuite/demangle-expected =================================================================== --- testsuite/demangle-expected (revision 226846) +++ testsuite/demangle-expected (working copy) @@ -4389,3 +4389,9 @@ f(std::string[abi:foo], std::string[abi: --format=gnu-v3 _Z18IndirectExternCallIPU7stdcallU7regparmILi3EEFviiEiEvT_T0_S3_ void IndirectExternCall stdcall*)(int, int), int>(void ( regparm<3> stdcall*)(int, int), int, void ( regparm<3> stdcall*)(int, int)) +# +# ABI tags used to confuse the constructor name calculation. +--format=gnu-v3 --no-params +_ZNSt8ios_base7failureB5cxx11C1EPKcRKSt10error_code +std::ios_base::failure[abi:cxx11]::failure(char const*, std::error_code const&) +std::ios_base::failure[abi:cxx11]::failure