[Bug c/77650] struct with a nested flexible array followed by another member accepted
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Sep 19 22:06:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77650
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Thanks for the background. It's unfortunate but I hope the Glibc code can be
accommodated without preventing GCC from detecting the same problem in user
code (and rejecting it with a hard error). One approach might be to base the
kind of the diagnostic (pedantic warning vs hard error) on whether the code
appears in a system header. Longer term, Glibc could be changed to use a
zero-length array instead of a flexible array member so that the GCC workaround
could eventually be removed. Another, perhaps more appropriate, approach might
be to add a new warning under -Wall and use it to diagnose this constraint
violation. The warning would be suppressed for system headers, allowing GCC to
silently accept the Glibc code.
More information about the Gcc-bugs
mailing list