diff mbox series

rs6000: Small improvement to the C++17 ABI fix [PR94707]

Message ID 20200423114800.GX2424@tucnak
State New
Headers show
Series rs6000: Small improvement to the C++17 ABI fix [PR94707] | expand

Commit Message

Jakub Jelinek April 23, 2020, 11:48 a.m. UTC
On Thu, Apr 23, 2020 at 05:24:19AM -0500, Segher Boessenkool wrote:
> > +		      inform (input_location,
> > +			      "parameter passing for argument of type %qT "
> > +			      "when C++17 is enabled changed to match C++14 "
> > +			      "in GCC 10.1", type);
> 
> It isn't "to match C++14".  It simply is a bugfix, we didn't follow
> the ABI before :-)

The reason for the exact wording was to make it clearer to the user
that C++17 doesn't have a different ABI from C++14 now, but it had in the
older releases.

Anyway, based on IRC discussion with Richard Sandiford on IRC, we should
probably test type uids instead of type pointers because type uids aren't
reused, but type pointers in a very bad luck case could be, and having the
static var at filescope and GTY((deletable)) is an overkill (and with costs
during GC time).

Ok if it passes bootstrap/regtest?

2020-04-23  Jakub Jelinek  <jakub@redhat.com>

	PR target/94707
	* config/rs6000/rs6000-call.c (rs6000_discover_homogeneous_aggregate):
	Use TYPE_UID (TYPE_MAIN_VARIANT (type)) instead of type to check
	if the same type has been diagnosed most recently already.



	Jakub

Comments

Segher Boessenkool April 23, 2020, 12:26 p.m. UTC | #1
On Thu, Apr 23, 2020 at 01:48:00PM +0200, Jakub Jelinek wrote:
> On Thu, Apr 23, 2020 at 05:24:19AM -0500, Segher Boessenkool wrote:
> > > +		      inform (input_location,
> > > +			      "parameter passing for argument of type %qT "
> > > +			      "when C++17 is enabled changed to match C++14 "
> > > +			      "in GCC 10.1", type);
> > 
> > It isn't "to match C++14".  It simply is a bugfix, we didn't follow
> > the ABI before :-)
> 
> The reason for the exact wording was to make it clearer to the user
> that C++17 doesn't have a different ABI from C++14 now, but it had in the
> older releases.

No, it used the same ABI then as well, but with a buggy implementation :-)

The ABI is not determined by GCC.

> Anyway, based on IRC discussion with Richard Sandiford on IRC, we should
> probably test type uids instead of type pointers because type uids aren't
> reused, but type pointers in a very bad luck case could be, and having the
> static var at filescope and GTY((deletable)) is an overkill (and with costs
> during GC time).
> 
> Ok if it passes bootstrap/regtest?
> 
> 2020-04-23  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/94707
> 	* config/rs6000/rs6000-call.c (rs6000_discover_homogeneous_aggregate):
> 	Use TYPE_UID (TYPE_MAIN_VARIANT (type)) instead of type to check
> 	if the same type has been diagnosed most recently already.
> 
> --- gcc/config/rs6000/rs6000-call.c.jj	2020-04-23 09:59:12.002172006 +0200
> +++ gcc/config/rs6000/rs6000-call.c	2020-04-23 13:42:10.037745872 +0200
> @@ -5739,14 +5739,15 @@ rs6000_discover_homogeneous_aggregate (m
>  		*n_elts = field_count;
>  	      if (cxx17_empty_base_seen && warn_psabi)
>  		{
> -		  static const_tree last_reported_type;
> -		  if (type != last_reported_type)
> +		  static unsigned last_reported_type_uid;
> +		  unsigned uid = TYPE_UID (TYPE_MAIN_VARIANT (type));
> +		  if (uid != last_reported_type_uid)
>  		    {
>  		      inform (input_location,
>  			      "parameter passing for argument of type %qT "
>  			      "when C++17 is enabled changed to match C++14 "
>  			      "in GCC 10.1", type);
> -		      last_reported_type = type;
> +		      last_reported_type_uid = uid;
>  		    }
>  		}
>  	      return true;

That looks fine, please go ahead.  Thanks :-)


Segher
diff mbox series

Patch

--- gcc/config/rs6000/rs6000-call.c.jj	2020-04-23 09:59:12.002172006 +0200
+++ gcc/config/rs6000/rs6000-call.c	2020-04-23 13:42:10.037745872 +0200
@@ -5739,14 +5739,15 @@  rs6000_discover_homogeneous_aggregate (m
 		*n_elts = field_count;
 	      if (cxx17_empty_base_seen && warn_psabi)
 		{
-		  static const_tree last_reported_type;
-		  if (type != last_reported_type)
+		  static unsigned last_reported_type_uid;
+		  unsigned uid = TYPE_UID (TYPE_MAIN_VARIANT (type));
+		  if (uid != last_reported_type_uid)
 		    {
 		      inform (input_location,
 			      "parameter passing for argument of type %qT "
 			      "when C++17 is enabled changed to match C++14 "
 			      "in GCC 10.1", type);
-		      last_reported_type = type;
+		      last_reported_type_uid = uid;
 		    }
 		}
 	      return true;