[Bug tree-optimization/86434] early string folding defeats strlen optimization and -Warray-bounds
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 9 10:48:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86434
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Are these examples from real-world code? Because I can create examples where
early folding is necessary as well...
It's really not an easy black-and-white decision.
Consider
void f (int i)
{
if (__builtin_strlen (&a[i]) != 3 - i)
{
... large code ...
}
}
void g ()
{
f (1);
}
where not folding and eliding the conditionaly will prevent inlining from
happening.
The usual "solution" is to do value-range analysis and folding at the same
time - thus avoiding pass inter-dependences by just having a single pass.
More information about the Gcc-bugs
mailing list