This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Miscompilation of remainder expressions


Roberto Bagnara wrote:

No, Paolo: the result of INT_MIN % -1 is zero, according to the standard.
There is no overflow whatsoever involved. The overflow that you see is
simply an artifact of GCC that produces assembly code that does not implement
remainder expressions correctly.

Ok, I believe you. However, isn't true that, in general, because the sign of the result is implementation defined, it's "risky" (non-portable, whatever), computing the remainder of two negative quantities? Or, what's the real meaning of 5.6/4?


Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]