See testcase, it's a GNU extension, but widely accepted (the linux kernel uses it). This got broken with 72b520e709d.
Unified · Split
| @@ -7660,6 +7660,10 @@ static void decl_initializer(init_params *p, CType *type, unsigned long c, int f · 7659 unmodified lines | |||
| 7660 | } | 7660 | } |
| 7661 | 7661 | ||
| 7662 | len = 0; | 7662 | len = 0; |
| 7663 | /* GNU extension: if the initializer is empty for a flex array, | ||
| 7664 | it's size is zero. We won't enter the loop, so set the size | ||
| 7665 | now. */ | ||
| 7666 | decl_design_flex(p, s, len); | ||
| 7663 | while (tok != '}' || (flags & DIF_HAVE_ELEM)) { | 7667 | while (tok != '}' || (flags & DIF_HAVE_ELEM)) { |
| 7664 | len = decl_designator(p, type, c, &f, flags, len); | 7668 | len = decl_designator(p, type, c, &f, flags, len); |
| 7665 | flags &= ~DIF_HAVE_ELEM; | 7669 | flags &= ~DIF_HAVE_ELEM; |
| @@ -15,6 +15,7 @@ int f1int (void) { · 14 unmodified lines | |||
| 15 | struct wint q = {"bugs"}; | 15 | struct wint q = {"bugs"}; |
| 16 | return !s[0]; | 16 | return !s[0]; |
| 17 | } | 17 | } |
| 18 | int empty[] = {}; // GNU extension | ||
| 18 | int main (void) { | 19 | int main (void) { |
| 19 | char s[9]="nonono"; | 20 | char s[9]="nonono"; |
| 20 | static struct wchar q = {"bugs", {'c'}}; | 21 | static struct wchar q = {"bugs", {'c'}}; |