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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> > Which raises the question what to do for the real-world case which won't
> > use char b[] since that's not C++ but would use char b[1] ...
> 
> To answer my own question, array_at_struct_end_p () covered padding must not
> be cleared.

If we do that, we'll violate C++20 I'd think.
For flexible array members we can choose what exactly we want to do, because we
are outside of the standard.  But when one uses:
#include <atomic>
struct S { char a; short b; };
struct T { char a; char b alignas (32); S c[1]; };
std::atomic<T> t;
then we can't pretend one can store meaningful values in c[3].b and expect it
to work.

Reply via email to