when encountering umodsi3 insertion, we simply emit the modsi3 insertion.
this is, of course, wrong. we need to fix it so that it handles *unsigned*
modulo correctly.
also, we should check the signed modulo, when the divisor is a negative
integer. ISO C standard states that "the binary % operator yields the
remainder from the division of the first expression by the second. .... If
both operands are nonnegative then the remainder is nonnegative; if not,
the sign of the remainder is implementation-defined." however, gcc conforms
to the euclidean definition of modulo (at least my tests suggest this),
which constrains the remainder to positive numbers. thus, 5 % -3 = 2.
this issue touches test case gcc.c-torture/execute/980526-3.c
Original issue reported on code.google.com by jmoc...@gmail.com on 8 Dec 2008 at 3:32
Original issue reported on code.google.com by
jmoc...@gmail.com
on 8 Dec 2008 at 3:32