https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117313
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:28b7aed124d4d86be552f24469c2cfa59a49edaf commit r15-4753-g28b7aed124d4d86be552f24469c2cfa59a49edaf Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Oct 29 20:14:09 2024 +0100 c-family: Handle RAW_DATA_CST in complete_array_type [PR117313] The following testcase ICEs, because add_flexible_array_elts_to_size -> complete_array_type is done only after braced_lists_to_strings which optimizes RAW_DATA_CST surrounded by INTEGER_CST into a larger RAW_DATA_CST covering even the boundaries, while I thought it is done before that. So, RAW_DATA_CST now can be the last constructor_elt in a CONSTRUCTOR and so we need the function to take it into account (handle it as RAW_DATA_CST standing for RAW_DATA_LENGTH consecutive elements). The function wants to support both CONSTRUCTORs without indexes and with them (for non-RAW_DATA_CST elts it was just adding 1 for the current index). So, if the RAW_DATA_CST elt has ce->index, we need to add RAW_DATA_LENGTH (ce->value) - 1, while if it doesn't (and it isn't cnt == 0 case where curindex is 0), add that plus 1, i.e. RAW_DATA_LENGTH (ce->value). 2024-10-29 Jakub Jelinek <ja...@redhat.com> PR c/117313 gcc/c-family/ * c-common.cc (complete_array_type): For RAW_DATA_CST elements advance curindex by RAW_DATA_LENGTH or one less than that if ce->index is non-NULL. Handle even the first element if it is RAW_DATA_CST. Formatting fix. gcc/testsuite/ * c-c++-common/init-6.c: New test.