This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C166 BUG: V4.25 generates incorrect code

To test the condition, I created new uVision project with default settings and compiled the following code:

bit bit1, bit2 = 1;
int i;

__inline bit getbit(void)
{
    return bit2;
}

void main(void)
{
    int a[1];
    bit1 = getbit();
    i = a[0];
}
Simulator intercepts Illegal Word Operand Access at the line i = a[0];. Disassembly shows that in the code for the line bit1 = getbit(); R0 is used for temporary storage, which corrupts the user stack pointer.

- mike