On Mon, 10 Apr 2017, Jason Merrill wrote: > On Mon, Apr 10, 2017 at 8:50 AM, Richard Biener <rguent...@suse.de> wrote: > > So here's my variant of a fix. I constrained the new flag > > TYPE_TYPELESS_STORAGE to arrays and thus hope my localized fix in > > build_cplus_array_type will suffice (if I have time I'll play with > > template instantiation). > > Looks good. I would expect this to just work with templates, but it > should of course be tested. In particular, std::aligned_storage needs > to work.
The libstdc++ testsuite passes... (of course it did before as well). I'll experiment with some trivial bits tomorrow. > > * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE > > for arrays of unsigned char or std::byte. > > I think it would be good to have a flag to select whether these > semantics apply to any char variant and std::byte, only unsigned char > and std::byte, or only std::byte. Any suggestion? Not sure we really need it (I'm hesitant to write all the testcases to verify it actually works). Meanwhile re-testing with the following hunk to fix some LTO fallout. Richard. Index: gcc/tree.h =================================================================== --- gcc/tree.h (revision 246808) +++ gcc/tree.h (working copy) @@ -4914,7 +4917,7 @@ inline bool canonical_type_used_p (const_tree t) { return !(POINTER_TYPE_P (t) - || TREE_CODE (t) == ARRAY_TYPE + || (TREE_CODE (t) == ARRAY_TYPE && ! TYPE_TYPELESS_STORAGE (t)) || TREE_CODE (t) == VECTOR_TYPE); }