On Wed, Apr 06, 2022 at 08:33:40PM +0800, Xi Ruoyao via Gcc-patches wrote:
> Another MIPS function return ABI fix.  Ok for trunk?
> 
> --
> 
> This fixes tmpdir-g++.dg-struct-layout-1/{t032,t059} failure.  Clang++
> ignores C++17 empty bases in return values as well.
> 
> gcc/
>       * config/mips/mips.cc (mips_fpr_return_fields): Ignore
>       cxx17_empty_base_field_p fields.
> ---
>  gcc/config/mips/mips.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
> index 0f2492219f3..5010f99f761 100644
> --- a/gcc/config/mips/mips.cc
> +++ b/gcc/config/mips/mips.cc
> @@ -6337,7 +6337,8 @@ mips_fpr_return_fields (const_tree valtype, tree 
> *fields,
>    i = 0;
>    for (field = TYPE_FIELDS (valtype); field != 0; field = DECL_CHAIN (field))
>      {
> -      if (TREE_CODE (field) != FIELD_DECL)
> +      if (TREE_CODE (field) != FIELD_DECL
> +       || cxx17_empty_base_field_p (field))
>       continue;
>  
>        if (DECL_FIELD_CXX_ZERO_WIDTH_BIT_FIELD (field))

Well, this won't diagnose the ABI change.
So, if cxx17_empty_base_field_p, it should set some flag before continuing
and if it is considered a fpr return and that flag is set, it should emit a
-Wpsabi warning too.

        Jakub

Reply via email to