[Bug c/101832] __builtin_object_size(P->M, 1) where M ends with a flex-array behaves like sizeof()

qinzhao at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 25 20:11:46 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832

--- Comment #6 from qinzhao at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #3)
> This is intentional, if you embed an aggregate with flex array into another
> struct and ask not to cross the field boundaries (i.e. bos1), then the size
> of that field is exactly what is the maximum size.

don't quite understand here:

why "embedding an aggregate with flex array member into another struct" is
asking not to cross the field boundaries? could you please explain a little bit
on this?


More information about the Gcc-bugs mailing list