> > > No they should be using -ftrapv instead which traps on overflow and then > > make sure they are not trapping when testing. > > - why? what language or who's code/target ever expects such a behavior? Everyone's who writes C/C++ should know that overflow of signed is undefined.
Now in Java it is defined, which is the reason why -fwrapv exists in the place since GCC has a "Java" compiler. I think you need to go back in the archives and read the disscusions about when -fwrapv was added and see why it is not turned on by default for C. http://gcc.gnu.org/ml/gcc-patches/2003-05/msg00850.html http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02126.html http://gcc.gnu.org/ml/gcc-patches/2003-03/msg01727.html And a couple more places. Thanks, Andrew Pinski