[Bug tree-optimization/84859] [8 Regression] bogus -Warray-bounds on a memcpy in a loop
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 14 13:34:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84859
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-03-14
Known to work| |7.3.1
Target Milestone|--- |8.0
Summary|bogus -Warray-bounds on a |[8 Regression] bogus
|memcpy in a loop |-Warray-bounds on a memcpy
| |in a loop
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The reason is a missed phiopt to MIN_EXPR for h and VRP not propagating through
memory.
we have
<bb 4> [local count: 955630223]:
if (n_6 > 255)
goto <bb 5>; [50.00%]
else
goto <bb 6>; [50.00%]
<bb 5> [local count: 477815112]:
a[0] = 255;
goto <bb 7>; [100.00%]
<bb 6> [local count: 477815112]:
_1 = (unsigned char) n_6;
a[0] = _1;
<bb 7> [local count: 955630223]:
_2 = a[0];
where we lack a pass replacing that with
<bb 7>
# tem = PHI <255(5), _1(6)>
a[0] = tem;
_2 = a[0];
and then a MIN_EXPR.
Not sure why thw warn_restrict pass ends up with this kind of value-range
here though. In the IL we have threaded the n > 255 check though and
ended up with an explicit memcpy (..., 255); but that's not [9, 255].
More information about the Gcc-bugs
mailing list