Modulo bug (ColdFire, CW 7.2)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modulo bug (ColdFire, CW 7.2)

1,206 Views
MrBean
Contributor I

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)

Labels (1)
0 Kudos
Reply
1 Reply

707 Views
MrBean
Contributor I

Apparently caused by unchecking "4-byte integers" in the compiler options.

Solved in V10 by not having this option ....

0 Kudos
Reply