From patchwork Sun Jan 17 00:42:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 569191 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 454AA14031B for ; Sun, 17 Jan 2016 11:43:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=kGKoTS5h; 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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=aaOfGYFzVs+D2wC9+vuGTGDIat/a9e9tq/kcebeoCbfbqr KRHJobWLqGG8cfDD6iYnNAL6BHli+AB3AnGLvfjRDxPlLO2V/OWdRPOEGqNt17tL qafv/zgSa4Ux6Hb3/mv8XKVooIV2wGu6pA72tYfRUmdPLYFwkz5nonw2KKyPk= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=rNRtzQrmVWZWhGn57LbUdf81qKo=; b=kGKoTS5hsln9G7o5kIxn hStKoYAdz+ZQgLvKIfuOKVdcYlabvVoK6KRueEiUUsCIRUs+NAxBBeksas1W8STN CP+ZcCaXkCOGUwyJRt09mJcydqRuzSmNmwuNQGUKUMklRCag2K8iKGC7eIUWQ9zo 0Pq0F+Ni8tzktWB47FyEGLY= Received: (qmail 130588 invoked by alias); 17 Jan 2016 00:42:52 -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 130576 invoked by uid 89); 17 Jan 2016 00:42:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=Exercise, 114 X-HELO: mail-qg0-f51.google.com Received: from mail-qg0-f51.google.com (HELO mail-qg0-f51.google.com) (209.85.192.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 17 Jan 2016 00:42:50 +0000 Received: by mail-qg0-f51.google.com with SMTP id o11so534674000qge.2 for ; Sat, 16 Jan 2016 16:42:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:content-type; bh=V4Vn83TBYgoqGiee2Xb3uql2mHSh8nKgAvyKSjyYsDc=; b=YlAn/wab8Gu/gwTQy+lOg/BYAPfKWIRRKiBzw8tqJbQI+IE5/24Q7RTajwes60cMb0 dhjSiyOpGo9MkPW9oiVMqEWkNbI205L/QGKJ3/ovYzWpva81/tRNYF4YrlLvOBZt50+A cEfoqFzu9xemFM0HuUNiwxn9CUIQmDe3csiAyJrlzf+u56Ds9/aJK/verfYxiWB1O6m2 96E2drxBucThm1q47PIt7LGTXFKCiLAp8rnFGE/8P74BDljeWE4W7z+mT8RJZf7bTGQl upfmjovMPhmL2PuIsYKeDuUuQNe0iDzk9cAfBCj84JFLSgul2QUu0iYjHirvsT74Zh+W dwIA== X-Gm-Message-State: ALoCoQmhTmw/T2hw9Dgy6aC+AvyjSzk46xNrPXoos3x0FRTojEXlimlGTyI561lvfjXwgYvFBEiWpbadWLeEhY3ulagR9ddOpQ== X-Received: by 10.140.29.202 with SMTP id b68mr22465787qgb.100.1452991368581; Sat, 16 Jan 2016 16:42:48 -0800 (PST) Received: from [192.168.0.26] (71-212-229-169.hlrn.qwest.net. [71.212.229.169]) by smtp.gmail.com with ESMTPSA id e11sm7402994qkj.44.2016.01.16.16.42.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Jan 2016 16:42:47 -0800 (PST) Message-ID: <569AE385.7010808@gmail.com> Date: Sat, 16 Jan 2016 17:42:45 -0700 From: Martin Sebor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Gcc Patch List , Jason Merrill Subject: [PATCH] fix #69317 - [6 regression] wrong ABI version in -Wabi warnings X-IsSubscribed: yes While adding an ABI warning in the patch for bug 69277 I noticed that the ABI version printed by GCC 6.0 in some -Wabi diagnostics is incorrect: while 5.1.0 prints the versions of the ABI given by the -Wabi=X and -fabi-version=Y options (i.e., it mentions both X and Y), 6.0 prints the same version twice (just Y). The attached patch fixes this and adds tests to verify that the referenced versions are as expected (it uses ABIs 2 and 3 but tests exercising the other ABI changes should be added as well). Martin gcc/cp/ChangeLog: 2016-01-16 Martin Sebor PR c++/69317 * mangle.c (mangle_decl): Reference the correct (saved) version of the ABI in -Wabi diagnostics. gcc/testsuite/ChangeLog: 2016-01-16 Martin Sebor PR c++/69317 * g++.dg/abi/Wabi-2-2.C: New test. * g++.dg/abi/Wabi-2-3.C: New test. * g++.dg/abi/Wabi-3-2.C: New test. * g++.dg/abi/Wabi-3-3.C: New test. Index: gcc/cp/mangle.c =================================================================== --- gcc/cp/mangle.c (revision 232296) +++ gcc/cp/mangle.c (working copy) @@ -3657,13 +3669,13 @@ mangle_decl (const tree decl) warning_at (DECL_SOURCE_LOCATION (G.entity), OPT_Wabi, "the mangled name of %qD changed between " "-fabi-version=%d (%D) and -fabi-version=%d (%D)", - G.entity, warn_abi_version, id2, - flag_abi_version, id); + G.entity, save_ver, id2, + warn_abi_version, id); else warning_at (DECL_SOURCE_LOCATION (G.entity), OPT_Wabi, "the mangled name of %qD changes between " "-fabi-version=%d (%D) and -fabi-version=%d (%D)", - G.entity, flag_abi_version, id, + G.entity, save_ver, id, warn_abi_version, id2); } Index: gcc/testsuite/g++.dg/abi/Wabi-2-2.C =================================================================== --- gcc/testsuite/g++.dg/abi/Wabi-2-2.C (revision 0) +++ gcc/testsuite/g++.dg/abi/Wabi-2-2.C (working copy) @@ -0,0 +1,14 @@ +// Verify that no diagnostic is issued when the version specified +// via -Wabi= matches the version specified by -fabi-version=. + +// { dg-options "-Werror -Wabi=2 -fabi-version=2" } +// { dg-do compile } + +// The mangling of templates with a non-type template parameter +// of reference type changed in ABI version 3: +extern int N; +template struct S { }; + +// Expect no diagnostic. +void foo (S) { } + Index: gcc/testsuite/g++.dg/abi/Wabi-2-3.C =================================================================== --- gcc/testsuite/g++.dg/abi/Wabi-2-3.C (revision 0) +++ gcc/testsuite/g++.dg/abi/Wabi-2-3.C (working copy) @@ -0,0 +1,16 @@ +// PR c++/69317 - [6 regression] wrong ABI version in -Wabi warnings +// Exercise that the correct ABI versions are referenced in the -Wabi +// diagnostic. See also the equivalent Wabi-3-2.C test. + +// { dg-options "-Wabi=2 -fabi-version=3" } +// { dg-do compile } + +// The mangling of templates with a non-type template parameter +// of reference type changed in ABI version 3: +extern int N; +template struct S { }; + +// Expect the diagnostic to reference the ABI version specified via +// -fabi-version=3 and the ABI version specified via -Wabi=2. +void foo (S) { } // { dg-warning "the mangled name of .void foo\\(S\\). changed between -fabi-version=3 \\(_Z3foo1SILZ1NEE\\) and -fabi-version=2 \\(_Z3foo1SIL_Z1NEE\\)" } + Index: gcc/testsuite/g++.dg/abi/Wabi-3-2.C =================================================================== --- gcc/testsuite/g++.dg/abi/Wabi-3-2.C (revision 0) +++ gcc/testsuite/g++.dg/abi/Wabi-3-2.C (working copy) @@ -0,0 +1,16 @@ +// PR c++/69317 - [6 regression] wrong ABI version in -Wabi warnings +// Exercise that the correct ABI versions are referenced in the -Wabi +// diagnostic. See also the equivalent Wabi-2-3.C test. + +// { dg-options "-Wabi=3 -fabi-version=2" } +// { dg-do compile } + +// The mangling of templates with a non-type template parameter +// of reference type changed in ABI version 3: +extern int N; +template struct S { }; + +// Expect the diagnostic to reference the ABI version specified via +// -fabi-version=2 and the ABI version specified via -Wabi=3. +void foo (S) { } // { dg-warning "the mangled name of .void foo\\(S\\). changed between -fabi-version=2 \\(_Z3foo1SIL_Z1NEE\\) and -fabi-version=3 \\(_Z3foo1SILZ1NEE\\)" } + Index: gcc/testsuite/g++.dg/abi/Wabi-3-3.C =================================================================== --- gcc/testsuite/g++.dg/abi/Wabi-3-3.C (revision 0) +++ gcc/testsuite/g++.dg/abi/Wabi-3-3.C (working copy) @@ -0,0 +1,14 @@ +// Verify that no diagnostic is issued when the version specified +// via -Wabi= matches the version specified by -fabi-version=. + +// { dg-options "-Werror -Wabi=3 -fabi-version=3" } +// { dg-do compile } + +// The mangling of templates with a non-type template parameter +// of reference type changed in ABI version 3: +extern int N; +template struct S { }; + +// Expect no diagnostic. +void foo (S) { } +