https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64185
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to zaz from comment #2) > But this is deliberate out-of-bands. IE in this test application searchDict2 > lookup all KV fields in dict structure in loop based on kv1 offset: > kv1 + 0 - this is pointer to kv1 > kv1 + 1 - this is pointer to kv2 > kv1 + 2 - this is pointer to kv3 > etc > All other C compilers (tested on CLANG and Microsoft C compiller) and early > version of GCC (for example 4.3 in CentOS 6) work with this test as expected. > And as I know many C projects (for example asterisk) use similar code for > manage complex structures. For example asterisk have a lot structures like > this: > struct PascalString > { > int length; > char data[0]; > }; > And then just allocate necessary memory block and able access to something > like: > ps.data[100] - if allocated block have enough size. This structure will always work. It is only the case where the array field is not at the end of the structure which is where it is undefined.