[Bug c++/55885] Modulo operator crashes for int and long variables if they have minimal value
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 7 15:34:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55885
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2013-01-07 15:34:34 UTC ---
INT_MIN % -1 and INT_MIN / -1 *should* be made defined by -fwrapv; that's
bug 30484.
Without -fwrapv, C11 made explicit the intent that the modulo operation is
undefined in the cases where division is undefined ("If the quotient a/b
is representable, the expression (a/b)*b + a%b shall equal a; otherwise,
the behavior of both a/b and a%b is undefined."); I don't know about C++.
More information about the Gcc-bugs
mailing list