[Bug target/94707] [8/9/10 Regression] class with empty base passed incorrectly with -std=c++17 on powerpc64le

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 22 09:13:07 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94707

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/config/rs6000/rs6000-call.c.jj  2020-03-30 22:53:40.746640328 +0200
+++ gcc/config/rs6000/rs6000-call.c     2020-04-22 11:07:05.507723606 +0200
@@ -5636,6 +5636,16 @@ rs6000_aggregate_candidate (const_tree t
            if (TREE_CODE (field) != FIELD_DECL)
              continue;

+           /* Ignore C++17 empty base fields, while their type indicates
+              they do contain padding, they have zero size and thus don't
+              contain any padding.  */
+           if (DECL_ARTIFICIAL (field)
+               && DECL_NAME (field) == NULL_TREE
+               && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))
+               && DECL_SIZE (field)
+               && integer_zerop (DECL_SIZE (field)))
+             continue;
+
            sub_count = rs6000_aggregate_candidate (TREE_TYPE (field), modep);
            if (sub_count < 0)
              return -1;

fixes the ABI difference, but more work will be needed to actually do the
-Wpsabi diagnostics, bet similarly to the aarch64 patch it needs to tell the
callers that the empty base field has been seen and ignored; now if the type
turns out to be a homogenous aggregate and whatever calls that function would
make a different decision based on whether it is homogenous or not, and the
c++17 empty base has been seen in it, then it should perform -Wpsabi
diagnostics.


More information about the Gcc-bugs mailing list