[Bug c/67882] surprising offsetof result on an invalid array member without diagnostic

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Nov 7 22:11:00 GMT 2015


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

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
We discussed this case and agreed it's invalid because it attempts to compute
the offset of an element of an array past the end.  The equivalent but correct
expression is:

assert(offsetof(s, fpr[32]) == offsetof(s, fpscr));


More information about the Gcc-bugs mailing list