https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64185
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to zaz from comment #4) > > > 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. > > So why it not work in this case: > struct PascalString > { > int length; > char data[0]; > char the_padding[1024]; > }; Because that is what the C standard say. And also the above code is invalid C.