This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/79929] [7 Regression] Bogus Warning: '__builtin_memset': specified size 4294967291 exceeds maximum object size 2147483647
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 13 Apr 2017 14:31:40 +0000
- Subject: [Bug middle-end/79929] [7 Regression] Bogus Warning: '__builtin_memset': specified size 4294967291 exceeds maximum object size 2147483647
- Auto-submitted: auto-generated
- References: <bug-79929-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79929
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, with -O1 one asks only for cheap optimizations, so the question is if a
warning that relies on more optimizations as this should be enabled at -O1.
We have:
p_18 = c_17(D) + 5;
...
if (p_18 < c_17(D))
goto <bb 3>; [0.00%]
else
goto <bb 4>; [0.00%]
<bb 3> [0.00%]:
c.2_7 = (long int) c_17(D);
p.3_8 = (long int) p_18;
_9 = c.2_7 - p.3_8;
_10 = (long unsigned int) _9;
_11 = n_16 + 5;
__builtin_memset (_11, 32, _10);
and cpp1 pass manages to fold the _10 into the huge value, but doesn't
similarly fold the pointer comparison. So either we should not do that at -O1,
or should also be able to fold (A + cst) < A for pointer type A into cst < 0
(only if POINTER_TYPE_OVERFLOW_UNDEFINED ?).