Modulo bug (ColdFire, CW 7.2)

Discussion created by MrBean on Aug 2, 2010
Latest reply on Aug 10, 2010 by MrBean

note: uint16 sum = 90;



 if( ( sum%15 ) != 0 ) 00010DE6: 7400            moveq    #0,d200010DE8: 3401            move.w   d1,d200010DEA: 700F            moveq    #15,d000010DEC: 84C0            divu.w   d0,d200010DEE: 4842            swap     d200010DF0: 6704            beq.s    ThisFunction+0xc8 (0x10df6); 0x00010df6



The result in d2 before the swap is 0x00000006.

After the swap it is 0x00060000.

Not  zero... 

Hence 90%15 is not zero, according to this compiler.


Be warned!

(Service request submitted)