https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84502
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Completely untested fix: --- gcc/stor-layout.c.jj 2018-02-13 21:23:29.187981310 +0100 +++ gcc/stor-layout.c 2018-02-21 21:43:24.783522853 +0100 @@ -1883,6 +1883,9 @@ finalize_type_size (tree type) && TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST) TYPE_SIZE_UNIT (type) = variable_size (TYPE_SIZE_UNIT (type)); + /* Handle empty records as per the x86-64 psABI. */ + TYPE_EMPTY_P (type) = targetm.calls.empty_record_p (type); + /* Also layout any other variants of the type. */ if (TYPE_NEXT_VARIANT (type) || type != TYPE_MAIN_VARIANT (type)) @@ -1895,6 +1898,7 @@ finalize_type_size (tree type) unsigned int precision = TYPE_PRECISION (type); unsigned int user_align = TYPE_USER_ALIGN (type); machine_mode mode = TYPE_MODE (type); + bool empty_p = TYPE_EMPTY_P (type); /* Copy it into all variants. */ for (variant = TYPE_MAIN_VARIANT (type); @@ -1911,11 +1915,9 @@ finalize_type_size (tree type) SET_TYPE_ALIGN (variant, valign); TYPE_PRECISION (variant) = precision; SET_TYPE_MODE (variant, mode); + TYPE_EMPTY_P (variant) = empty_p; } } - - /* Handle empty records as per the x86-64 psABI. */ - TYPE_EMPTY_P (type) = targetm.calls.empty_record_p (type); } /* Return a new underlying object for a bitfield started with FIELD. */