Current snapshot (2.6.1 #4472) contains some bug in code generation for unsigned int (and unsigned short) addition. Result is incorrect for some values of operands.
My sample code:
volatile unsigned int i,j,k;
k=i+j; // 0x06f4+0x037a=0x0a6e
PORTB=k>>8; // just to verify MSB of result
Result k should be 0xa6e, but is 0x66e.
sdcc -mpic14 -p16f84 addtest.c
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.6.1 #4472 (Nov 18 2006) (UNIX)
This problem doesn't appear in last stable version (2.6.0 #4309 (Jul 28 2006) (UNIX)_.
Log in to post a comment.