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

--- Comment #34 from Kees Cook <kees at outflux dot net> ---
-fstrict-flex-arrays=3 is still needed. (E.g. for proper FORTIFY coverage,
etc.) I don't have an opinion about the -W options, though.(In reply to James Y
Knight from comment #33)
> (In reply to qinzhao from comment #32)
> > there is a Bugzilla that has been filed for GCC to request the same warning
> > for GCC:
> > https://gcc.gnu.org/bugzilla//show_bug.cgi?id=94428
> > 
> > -Wzero-length-array
> 
> Great. Adding that flag, and eliminating the -fstrict-flex-arrays=3 option
> from this proposal would be good.

Hmm? No, -fstrict-flex-arrays=3 is still needed (because it changes compiler
_behavior_, e.g. for proper FORTIFY coverage or trailing arrays, etc).

I don't have a strong opinion about the -W options; but they can't warn if they
just see a struct declaration with a 0 or 1 element array: userspace will have
those for years to come. Maybe it would warn if such a struct member is ever
actually used in the code? That kind of behavior would be useful for the Linux
kernel at least.

Reply via email to