diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-10-29 20:14:09 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-10-29 20:14:09 +0100 |
commit | 28b7aed124d4d86be552f24469c2cfa59a49edaf (patch) | |
tree | 8af23ef0151e2ddc15494f50222d356956f4d9e1 /gcc/fortran/error.cc | |
parent | e6d21cbf5cf035b6fa9946a4321f87cbcfa9f275 (diff) | |
download | gcc-28b7aed124d4d86be552f24469c2cfa59a49edaf.zip gcc-28b7aed124d4d86be552f24469c2cfa59a49edaf.tar.gz gcc-28b7aed124d4d86be552f24469c2cfa59a49edaf.tar.bz2 |
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 <jakub@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.
Diffstat (limited to 'gcc/fortran/error.cc')
0 files changed, 0 insertions, 0 deletions