[Bug tree-optimization/86936] strnlen() of a constant not folded due to laddress transformation

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 21 13:25:00 GMT 2018


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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note to GIMPLE &a[1][i_3(D)] is just address-computation and carries no
semantics so you can't assume that i_3(D) isn't negative and thus ends up
accessing "123".  For the C testcase you of course can, but once we're
in GIMPLE you cannot.

If there's a load like

 _7 = a[1][i_3(D)];

you _can_ assume that i_3(D) fits in the respective array types domain.


More information about the Gcc-bugs mailing list