Compiler bug results in crashing code

Below some sample code with the generated assembly. You will see that under some coditions there will be PUSH AR7. This push is never removed from stack and it will keep growing until the program is crashing completely. Uncommenting the commented function will solve the problem, but sometimes one would like to do things like below. (Compiled in SMALL model optimisation=6 and C51 V6.02)


volatile unsigned char xdata Result;
extern void CommentedFunction(void);

void any(void)
{
if ( (Result >= 1) && (Result <= 5) )
{
// CommentedFunction();
}

Function();
}

MOV DPTR,#Result
MOVX A,@DPTR
CLR C
SUBB A,#01H
JC ?C0001
MOVX A,@DPTR
MOV R7,A
PUSH AR7
?C0001:
LCALL Function
RET

Parents Reply Children
No data
More questions in this forum