[Bug tree-optimization/43089] Optimizer ignores type in a conversion
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Feb 16 11:56:00 GMT 2010
------- Comment #4 from jakub at gcc dot gnu dot org 2010-02-16 11:56 -------
There is nothing to fix. Your program triggers undefined behavior. It can do
anything, which can include something you'd expect, or something completely
different and it can depend on compiler options, position of stars, etc.
As Richard said, if you want signed overflow to be well defined, compile with
-fwrapv. Or, avoid doing the addition in this case in a signed type when you
want it to wrap. E.g. b2 = (unsigned) ab.b + ab.b; does the addition in
unsigned type where wrapping is well defined (and even no wrapping occurs for
0x7fffffffU + 0x7fffffffU).
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43089
More information about the Gcc-bugs
mailing list