[Bug tree-optimization/48795] -Warray-bounds false positive

niko.lecam at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun May 1 10:27:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48795

--- Comment #3 from Nicolas Le Cam <niko.lecam at gmail dot com> 2011-05-01 10:11:47 UTC ---
(In reply to comment #2)
> "r1->data[1] = prm2" goes above "char data[1]" bounds. How it's a false
> positive?

Because the structure is a kind of flexible array (code has to follow C89/C90
standard) and is big enough to handle a second member.

(Or the warning has to be emitted even if you remove the call to p, which is
not the case actually)

This example is a deliberate use of overflow to circumvent the absence of
flexible arrays in C89/C90, disabling Warray-bounds to avoid the flood it
generates isn't the right solution IMHO.



More information about the Gcc-bugs mailing list