[Bug c++/93210] Sub-optimal code optimization on struct/combound constexpr (gcc vs. clang)
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 9 15:24:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93210
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-01-09
Ever confirmed|0 |1
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Apparently it isn't related to anonymous aggregates at all.
And, before r273435 aka
https://gcc.gnu.org/ml/gcc-patches/2019-07/msg00893.html
(so e.g. in GCC 9 and earlier) we weren't simplifying the u.b case either).
Since r273435 fold_array_ctor_reference can handle extraction from multiple
fields, but fold_nonarray_ctor_reference still doesn't, so this PR could be
fixed by teaching it to handle it.
It might be also worth to either add CONSTRUCTOR support to native_encode_expr,
or add a wrapper to that function for fold*ctor_reference that would handle
that and perform native encoding of a whole CONSTRUCTOR (provided that its
ultimate elements are only what native_encode_expr supports), but first
clearing the whole range of the buffer and then just recursing in there.
More information about the Gcc-bugs
mailing list