https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105684
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |56456 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- The issue is that 'result->data0.a' is (*result).data0.a, and so to GCC you are accessing an object of type 'obj' for which there isn't enough allocated space. Now - I think the array bound diagnostic could be improved to better highlight this. A workaround might be to declare 'obj' as struct obj { unsigned long long kind; unsigned long long data[]; }; if in your case all data is really uniform 'unsigned long long'. There's no way to union several different typed flexarrays though. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456 [Bug 56456] [meta-bug] bogus/missing -Warray-bounds