On 8/9/19 10:22 AM, Jakub Jelinek wrote: > On Fri, Aug 09, 2019 at 10:17:12AM -0600, Martin Sebor wrote: >> --- a/gcc/gengtype-state.c >> +++ b/gcc/gengtype-state.c >> @@ -79,6 +79,14 @@ enum state_token_en >> STOK_NAME /* hash-consed name or identifier. */ >> }; >> >> +/* Suppress warning: ISO C forbids zero-size array for stok_string >> + below. The arrays are treated as flexible array members but in >> + otherwise an empty struct or as a member of a union cannot be >> + declared as such. They must have zero size to keep GCC from >> + assuming their bound reflect their size. */ >> +#pragma GCC diagnostic push >> +#pragma GCC diagnostic ignored "-Wpedantic" >> + >> >> /* Structure and hash-table used to share identifiers or names. */ >> struct state_ident_st >> @@ -86,11 +94,10 @@ struct state_ident_st >> /* TODO: We could improve the parser by reserving identifiers for >> state keywords and adding a keyword number for them. That would >> mean adding another field in this state_ident_st struct. */ >> - char stid_name[1]; /* actually bigger & null terminated */ >> + char stid_name[0]; /* actually bigger & null terminated */ > > No, please don't do this. The part of the GCC that is built by system > compiler shouldn't use GNU extensions, unless guarded only for compilation > with compilers that do support that. Hmm, this wasn't supposed to be in the diff anymore (the patch handles the code without these changes). I removed it after verifying it just before sending the patch so my mailer must have sent a cached copy. Attached is the latest tested patch without this change. That said, we should change this code one way or the other. There is even less of a guarantee that other compilers support writing past the end of arrays that have non-zero size than that they recognize the documented zero-length extension. Martin