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

Reply via email to