This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/65627] missed warning with -Waggressive-loop-optimizations


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]