On 2014-04-10 11:48:44 +0000, Thorsten Glaser wrote: > Ian Jackson dixit: > > >> If the architecture uses two's complement, however, then the code is > >> correct. > > > >Unfortunately adversarial optimisation by modern compilers means that > >this kind of reasoning is no longer valid. > > > >The compiler might easily see that your code unconditionally performs > >a computation with undefined behaviour, and delete it. > > And GCC is a repeat offender which actually does do that.
If you don't like that, you should use the -fwrapv option. -- Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: https://lists.debian.org/[email protected]

