------- Comment #2 from manu at gcc dot gnu dot org 2007-03-08 14:38 ------- I think you are relying on the fact that signed overflow wraps, when in standard C it is actually undefined (it may wrap, it may not). To make integers wrap on overflow you use unsigned or -fwrapv.
Thus, I think this is a duplicate of PR 30475. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31083