On 27.04.20 09:36, Jakub Jelinek wrote: > On Mon, Apr 27, 2020 at 08:41:32AM +0200, Andreas Krebbel wrote: >> Ok. Thanks for doing this! > > Thanks, committed. > >> We probably have to look into providing a -Wpsabi warning as well. > > So like this? Untested except on a small testcase. > > 2020-04-27 Jakub Jelinek <ja...@redhat.com> > > PR target/94704 > * config/s390/s390.c (s390_function_arg_vector, > s390_function_arg_float): Emit -Wpsabi diagnostics if the ABI changed.
Wow, that was quick. I just started to have a look at it. Ok. Thanks! Andreas > > --- gcc/config/s390/s390.c.jj 2020-04-27 09:11:47.600095196 +0200 > +++ gcc/config/s390/s390.c 2020-04-27 09:24:53.583055720 +0200 > @@ -11911,16 +11911,22 @@ s390_function_arg_vector (machine_mode m > > /* The ABI says that record types with a single member are treated > just like that member would be. */ > + bool cxx17_empty_base_seen = false; > while (TREE_CODE (type) == RECORD_TYPE) > { > tree field, single = NULL_TREE; > > for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) > { > - if (TREE_CODE (field) != FIELD_DECL > - || cxx17_empty_base_field_p (field)) > + if (TREE_CODE (field) != FIELD_DECL) > continue; > > + if (cxx17_empty_base_field_p (field)) > + { > + cxx17_empty_base_seen = true; > + continue; > + } > + > if (single == NULL_TREE) > single = TREE_TYPE (field); > else > @@ -11940,7 +11946,22 @@ s390_function_arg_vector (machine_mode m > } > } > > - return VECTOR_TYPE_P (type); > + if (!VECTOR_TYPE_P (type)) > + return false; > + > + if (warn_psabi && cxx17_empty_base_seen) > + { > + static unsigned last_reported_type_uid; > + unsigned uid = TYPE_UID (TYPE_MAIN_VARIANT (type)); > + if (uid != last_reported_type_uid) > + { > + last_reported_type_uid = 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); > + } > + } > + return true; > } > > /* Return true if a function argument of type TYPE and mode MODE > @@ -11962,15 +11983,20 @@ s390_function_arg_float (machine_mode mo > > /* The ABI says that record types with a single member are treated > just like that member would be. */ > + bool cxx17_empty_base_seen = false; > while (TREE_CODE (type) == RECORD_TYPE) > { > tree field, single = NULL_TREE; > > for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) > { > - if (TREE_CODE (field) != FIELD_DECL > - || cxx17_empty_base_field_p (field)) > + if (TREE_CODE (field) != FIELD_DECL) > continue; > + if (cxx17_empty_base_field_p (field)) > + { > + cxx17_empty_base_seen = true; > + continue; > + } > > if (single == NULL_TREE) > single = TREE_TYPE (field); > @@ -11984,7 +12010,23 @@ s390_function_arg_float (machine_mode mo > type = single; > } > > - return TREE_CODE (type) == REAL_TYPE; > + if (TREE_CODE (type) != REAL_TYPE) > + return false; > + > + if (warn_psabi && cxx17_empty_base_seen) > + { > + static unsigned last_reported_type_uid; > + unsigned uid = TYPE_UID (TYPE_MAIN_VARIANT (type)); > + if (uid != last_reported_type_uid) > + { > + last_reported_type_uid = 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); > + } > + } > + > + return true; > } > > /* Return true if a function argument of type TYPE and mode MODE > > > Jakub >