https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80293
--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> --- (In reply to Richard Biener from comment #4) > That said, the array cases we've seen are somewhat disturbing... Cases? Can you point me to the other ones, please? What type do they have? > maybe we can disable total scalarization for those? The support for total scalarization of arrays was added by Alan Lawrence as a part of constant pool SRA and I suppose that for a good reason (the added testcases have them at least). However, thinking about this particular testcase a bit more, I think the most reasonable thing to do is to disable total scalarization of char (or generally byte-sized-element) arrays. Those are likely just some anonymous storage anyway: diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 02453d3ed9a..cbe9e862a2f 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -981,7 +981,7 @@ scalarizable_type_p (tree type) if (TYPE_DOMAIN (type) == NULL_TREE || !tree_fits_shwi_p (TYPE_SIZE (type)) || !tree_fits_shwi_p (TYPE_SIZE (TREE_TYPE (type))) - || (tree_to_shwi (TYPE_SIZE (TREE_TYPE (type))) <= 0) + || (tree_to_shwi (TYPE_SIZE (TREE_TYPE (type))) <= BITS_PER_UNIT) || !tree_fits_shwi_p (TYPE_MIN_VALUE (TYPE_DOMAIN (type)))) return false; if (tree_to_shwi (TYPE_SIZE (type)) == 0