I am simulating an ATmega168 in Studio4.12 SP3 b490 and getting the message:
AVR Simulator:Stack Underflow at 0x08a5
This occurs when I simulate the RET at 0x08a5 the stack pointer moves from 0x04FD to 0x04FF as RAMEND on a ATmega168 is at 0x04FF this is not a stack underflow.
More oddly it depends how the program gets to 0x08a5 by one route it always generates the message by another the message never occurs.
Am I missing something ? Even if its a bug there should be something in the pattern to narrow it down but I can't see it.