https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77679
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- 5646 /* Static constructors for variably sized objects makes no sense. */ 5647 gcc_assert (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor)))) 5648 == INTEGER_CST); aha... (gdb) p debug_generic_expr (ctor->typed.type) character(kind=1)[2][1:n (&C.3418)] It's easy to make the folding routines not ICE by replacing the assert with giving up. Will do that but leave the bug open as accepts-invalid (the diagnosis is from the time we try to output the variable). Testing Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 240342) +++ gcc/gimple-fold.c (working copy) @@ -5647,14 +5638,15 @@ fold_array_ctor_reference (tree type, tr if (domain_type && TYPE_MIN_VALUE (domain_type)) { /* Static constructors for variably sized objects makes no sense. */ - gcc_assert (TREE_CODE (TYPE_MIN_VALUE (domain_type)) == INTEGER_CST); + if (TREE_CODE (TYPE_MIN_VALUE (domain_type)) != INTEGER_CST) + return NULL_TREE; low_bound = wi::to_offset (TYPE_MIN_VALUE (domain_type)); } else low_bound = 0; /* Static constructors for variably sized objects makes no sense. */ - gcc_assert (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor)))) - == INTEGER_CST); + if (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor)))) != INTEGER_CST) + return NULL_TREE; elt_size = wi::to_offset (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor)))); /* We can handle only constantly sized accesses that are known to not