https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79373

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---

(In reply to Steven Pigeon from comment #2)
> (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?).

loop-bug/test-wave-stream.cpp:29:10: runtime error: signed integer overflow:
32641 * 65793 cannot be represented in type 'int'

> 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.

No, that's not what undefined behaviour means.

Reply via email to