[Bug middle-end/79929] [7 Regression] Bogus Warning: '__builtin_memset': specified size 4294967291 exceeds maximum object size 2147483647

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 13 17:12:00 GMT 2017


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

--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
I actually think that for the test case in comment #4, the warning does
highlight a problem in the code: since the test (p < c) can never be true the
memset can never be called in a valid program.  At -O2 the problem is detected
by -Wstrict-overflow.  Unfortunately, because -Wstrict-overflow is only issued
when an optimization takes place that depends on the absence of an overflow, it
can't be issued at -O1 when the condition isn't removed.  I still think that
eliminating the memset call (or replacing it with a trap) when the size is
known to be excessive is a viable strategy.  (For memset perhaps under an
option to allow for the rare programs that make use of Physical Address
Extension and clear memory regions larger than 2GB.)


More information about the Gcc-bugs mailing list