From patchwork Wed Apr 6 16:22:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 607090 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 3qg9wr5QYHz9sDD for ; Thu, 7 Apr 2016 02:22:19 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=CHQ71RDq; 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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=Ur5VoVzLJYsZ2vMYiOlZVbnEik9oP9bS2MXpUVXzOFmMMldK9E CM+xgkGzPRgrnx+WMAsqS9OE/29Fr6j3u1vpnrOssoxtBzEB3BR06nqQKaScFxlB B3bj5d7UqQYSwXCwH4c5Q8vQ/igZRna1PdVFmUuDJbgZFwJGU7X+7MD2M= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=7LKKqd2GaiAUPPLY9AVJnSeXoMw=; b=CHQ71RDqbRf6qY5Sc1CB DJjdFD2TKxXFXSYlqUo/s1xUgYgOx3qMoITOSXtN4v4DCzp812VSynG+mGB2UklO NLJgbTPMP6XMfJUWZu0SPTMN96ZXrm8MKD40ggYPUMru+ZEuXjczE2kASD6BNVff /7xcd4R1D5EuVhAJcA58zv4= Received: (qmail 130147 invoked by alias); 6 Apr 2016 16:22:11 -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 130135 invoked by uid 89); 6 Apr 2016 16:22:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1487, our X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 06 Apr 2016 16:22:09 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 035ECC05681A for ; Wed, 6 Apr 2016 16:22:07 +0000 (UTC) Received: from [10.10.116.28] (ovpn-116-28.rdu2.redhat.com [10.10.116.28]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u36GM7Ws003915 for ; Wed, 6 Apr 2016 12:22:07 -0400 To: gcc-patches List From: Jason Merrill Subject: C++ PATCH for implicit abi_tag on template member function Message-ID: <570537AF.4020300@redhat.com> Date: Wed, 6 Apr 2016 12:22:07 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 We were incorrectly omitting the ABI tag on the instantiation of this member function because we were setting the tags on the instantiation and looking for them on the temploid. Tested x86_64-pc-linux-gnu, applying to trunk. commit 32a5b18940f37dd97c2735f24a8353d1db457d86 Author: Jason Merrill Date: Wed Apr 6 07:45:02 2016 -0400 * class.c (check_abi_tags): Fix function template handling. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 937e41f..02a992f 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1604,6 +1604,15 @@ check_abi_tags (tree t, tree subob) void check_abi_tags (tree decl) { + tree t; + if (abi_version_at_least (10) + && DECL_LANG_SPECIFIC (decl) + && DECL_USE_TEMPLATE (decl) + && (t = DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (decl)), + t != decl)) + /* Make sure that our template has the appropriate tags, since + write_unqualified_name looks for them there. */ + check_abi_tags (t); if (VAR_P (decl)) check_abi_tags (decl, TREE_TYPE (decl)); else if (TREE_CODE (decl) == FUNCTION_DECL diff --git a/gcc/testsuite/g++.dg/abi/abi-tag19.C b/gcc/testsuite/g++.dg/abi/abi-tag19.C new file mode 100644 index 0000000..e21d7b1 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag19.C @@ -0,0 +1,4 @@ +struct __attribute__((abi_tag("a"))) X { }; +template struct Y { X f() { return X(); } }; +template struct Y; +// { dg-final { scan-assembler "_ZN1YIiE1fB1aEv" } }