When I run the following code, sdcc pauses for about 30s and is then killed.
I wouldn't necessarily expect sdcc to be able to handle this, but perhaps to give an error in this situation (perhaps with line number of the problem rule).
/// GPL 2.0 or later
#include <stdio.h>
int div64( int a ) {
return a / 64;
}
int main() {
printf("Start\n");
printf("Mult %d", div64( 200 ) );
printf("End\n");
return 0;
}
#ifdef __SDCC
__sfr __at 0xff sif;
int putchar( int c ) {
sif = 'p';
sif = c;
return c;
}
#endif
// sdcc -mz80 peep-overflow.c --peep-file ./peep-rules.txt
replace {
sra %1
rr %2
sra %1
rr %2
sra %1
rr %2
sra %1
rr %2
sra %1
rr %2
sra %1
rr %2
} by {
ld a, %2
sra %1
rra
sra %1
rra
sra %1
rra
sra %1
rra
sra %1
rra
sra %1
rra
ld %2, a
}
time sdcc -mz80 peep-overflow.c --peep-file ./peep-rules.txt
Killed
real 0m33.329s
sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502 TD- 4.2.12 #13827 (Linux)
Fixed in [r14554] in the next branch.
Related
Commit: [r14554]
The next branch has been merged to trunk.