[Bug c++/79373] For loop optimization bug: condition ignored
steven.p.pigeon at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Feb 4 04:33:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79373
--- Comment #2 from Steven Pigeon <steven.p.pigeon at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> I am suspecting this:
> t*=65793;
>
> overflows.
>
> Can you try with -fsanitize=undefined ?
The bug disappears with
g++ -fsanitize=undefined -O3 -std=c++11 test-wave-stream.cpp
Yes, it overflows for some values (and is undefined behavior?).
But it shouldn't affect the for-loop. At worse, the returned values should be
random-looking and the unit test should fail with a message.
More information about the Gcc-bugs
mailing list