------- Comment #3 from pinskia at gcc dot gnu dot org 2006-02-19 02:21 ------- (In reply to comment #2) > OK, -fwrapv fixes it. But what if I do this, shouldn't it work as I expect? > (It doesn't without -fwrapv.) Also, what is the safe way to do what I want?
Use -fwrapv since that defines signed overflow as wrapping. You could also use unsigned types but that might not get the correct answer for some cases. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26358