This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/86094, wrong calling convention for move-only class
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, Richard Biener <rguenther at suse dot de>
- Date: Wed, 13 Jun 2018 17:05:23 -0400
- Subject: Re: C++ PATCH for c++/86094, wrong calling convention for move-only class
- References: <CADzB+2niH+fNdufwCs6tzbjo1Ums=JJnCyriqB0df6YBX3DdwA@mail.gmail.com> <CADzB+2=A8GSacQnoc8tP-0iQp0-JJM5aneChepF_5CLi92fsOg@mail.gmail.com>
On Wed, Jun 13, 2018 at 4:12 PM, Jason Merrill <jason@redhat.com> wrote:
> On Mon, Jun 11, 2018 at 2:38 PM, Jason Merrill <jason@redhat.com> wrote:
>> The fix for 80178 was broken, because I forgot that copy_fn_p is false
>> for move constructors. As a result, the calling convention for a
>> class with a trivial move constructor and deleted copy constructor
>> changed inappropriately.
>
> This patch restores the broken behavior to -fabi-version=12 and adds
> -fabi-version=13 for the fix; people can use -Wabi=12 with GCC 8.2 to
> check for compatibility issues against 8.1, or -Wabi=11 to check
> compatibility with GCC 7.
>
> Tested x86_64-pc-linux-gnu, applying to trunk and 8. Do we want to
> accelerate 8.2 because of this issue?
And one more patch, to suggest -Wabi=11 rather than useless plain -Wabi.
Tested x86_64-pc-linux-gnu, applying to trunk and 8.
commit bf7773e6fa607769b619535e1b22272a36726868
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jun 13 16:09:46 2018 -0400
* c-opts.c (c_common_post_options): Warn about useless -Wabi.
(c_common_handle_option) [OPT_Wabi_]: Remove flag_abi_compat_version
handling.
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 107359ec20d..bbcb1bb1a9c 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -417,8 +417,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
value = 2;
}
warn_abi_version = value;
- if (flag_abi_compat_version == -1)
- flag_abi_compat_version = value;
break;
case OPT_fcanonical_system_headers:
@@ -942,7 +940,17 @@ c_common_post_options (const char **pfilename)
{
warn_abi_version = latest_abi_version;
if (flag_abi_version == latest_abi_version)
- flag_abi_compat_version = abi_compat_default;
+ {
+ if (warning (OPT_Wabi, "-Wabi won't warn about anything"))
+ {
+ inform (input_location, "-Wabi warns about differences "
+ "from the most up-to-date ABI, which is also used "
+ "by default");
+ inform (input_location, "use e.g. -Wabi=11 to warn about "
+ "changes from GCC 7");
+ }
+ flag_abi_compat_version = abi_compat_default;
+ }
else
flag_abi_compat_version = latest_abi_version;
}
diff --git a/gcc/testsuite/g++.dg/abi/pr83489.C b/gcc/testsuite/g++.dg/abi/pr83489.C
index aee04eca9d8..b6c82ef16e6 100644
--- a/gcc/testsuite/g++.dg/abi/pr83489.C
+++ b/gcc/testsuite/g++.dg/abi/pr83489.C
@@ -1,5 +1,5 @@
// PR c++/83489
-// { dg-options "-Wabi" }
+// { dg-options "-Wabi=11" }
struct A
{
diff --git a/gcc/testsuite/obj-c++.dg/bitfield-1.mm b/gcc/testsuite/obj-c++.dg/bitfield-1.mm
index a63761904b5..084d2cb0916 100644
--- a/gcc/testsuite/obj-c++.dg/bitfield-1.mm
+++ b/gcc/testsuite/obj-c++.dg/bitfield-1.mm
@@ -5,7 +5,7 @@
superclasses should be removed). */
/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
/* { dg-do run } */
-/* { dg-options "-Wpadded -Wabi" } */
+/* { dg-options "-Wpadded -Wabi=8" } */
/* Leave blank lines here to keep warnings on the same lines. */
diff --git a/gcc/testsuite/obj-c++.dg/layout-1.mm b/gcc/testsuite/obj-c++.dg/layout-1.mm
index 33879ad17a4..89921236ec3 100644
--- a/gcc/testsuite/obj-c++.dg/layout-1.mm
+++ b/gcc/testsuite/obj-c++.dg/layout-1.mm
@@ -1,7 +1,7 @@
/* Ensure that we do not get bizarre warnings referring to
__attribute__((packed)) or some such. */
/* { dg-do compile } */
-/* { dg-options "-Wpadded -Wpacked -Wabi" } */
+/* { dg-options "-Wpadded -Wpacked -Wabi=8" } */
#include "../objc-obj-c++-shared/TestsuiteObject.h"