https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119207
Bug ID: 119207
Summary: ICE after error with flexible array definition and too
large size for array
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: error-recovery, ice-on-invalid-code
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Testcase:
```
struct flexible {
int length;
int data[];
};
struct flexible x
= {0,{ [-2ull] = 0 }};
```
Gives correctly an error message but then ICEs:
```
<source>:6:1: error: size of array is too large
6 | = {0,{ [-2ull] = 0 }};
| ^
<source>:6:1: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in add_flexible_array_elts_to_size, at
c/c-decl.c:4914
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
```