Message ID | 4a202164da6a53b1f892dedb3e2d42ecd612e379.camel@mengyan1223.wang |
---|---|
State | New |
Headers | show |
Series | mips: Fix C++14 vs. C++17 ABI incompatibility on mips64 | expand |
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
On Wed, 2022-04-06 at 14:44 +0200, Jakub Jelinek wrote: > 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. Ok, will add it. When I learnt from PR94704 fix I failed to notice the second commit adding -Wpsabi warning :(.
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))