[Bug tree-optimization/65627] missed warning with -Waggressive-loop-optimizations
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 30 13:25:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65627
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That is very much intentional. The warning is documented to do that:
Warn if in a loop with constant number of iterations the compiler
detects undefined behavior in some statement during one or more of
the iterations.
and in this case the loop obviously doesn't have constant number of iterations.
You could have say constructor changing the
a array to contain value 6 in a[1], a[2] or a[3] and the code would be
completely valid then, trying to warn about it would be obvious false positive.
There is simply no way to have a reliable warning in these cases.
More information about the Gcc-bugs
mailing list