[Bug c++/64490] incorrect -O2 and -O3 optimization of the slightly different template functions

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jan 4 20:45:00 GMT 2015


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

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

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Anton Skidin from comment #0)
> Of course, there is an integer overflow in the code and theoretically its
> behaviour could depend on the hardware it is executed on.
> However, the compiler should at least produce the same results for the same
> command line argument and for the equivalent parts of the code.

No, the code has undefined behaviour so anything can happen, you are wrong to
expect the same results.



More information about the Gcc-bugs mailing list