I just use sdcc for two weeks now and have a problem
which I believe is a bug:
The following code snippet should measure the counter
value every 10 ms (or so) and output the difference
between the last measurement and the current counter
However, sdcc seems to remove the 'oldx = x;'
assignment. It cannot be found anywhere in the asm
oldx = x;
x = TMR0L + 256 * TMR0H;
diff = x - oldx;
printf("Count: %ld (%ld, %ld) \n", x,
What am I doing wrong?
sdcc snapshot is version "SDCC : mcs51/gbz80/z80/avr/ds
390/pic16/pic14/TININative/xa51/ds400/hc08 2.5.6 #
(Apr 24 2006) (UNIX)"
I run sdcc as "sdcc -mpic16 -p18f2550 badoptimization.c
Log in to post a comment.