[Bug c/79546] Strange error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]

2017-02-16 Thread rjones at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79546

Richard W.M. Jones  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Richard W.M. Jones  ---
I think the warning is enabled by the build system.  It's not something we
enable explicitly.  Anyhow I have disabled it since it seems as if this warning
doesn't indicate a bug in the code.

[Bug c/79546] Strange error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]

2017-02-15 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79546

--- Comment #1 from Andrew Pinski  ---
>-Werror=unsafe-loop-optimizations

That is not enabled by default even with -Werror -W -Wall.

But "missed loop optimization, the loop counter may overflow" is basically
saying if i was an signed integer, the loop counter would overflow in some
cases.  The case depends the value of len.  The only way to fix this would be
rewrite the code so that case would not happen.
The cases where it would happen is len = SIZET_MIN ... SIZET_MIN-0x0FFF (if I
did my math correctly).