The direct use of the stack pointer to reference local variables is probably caused by the use of compiler optimizations. I think you could solve the issue in a couple of ways:
- Disabling frame pointer optimizations (
-fno-omit-frame-pointerin GCC); - Inserting
espin the Clobbers so the compiler will be aware that its value is being modified (check your compiler for compatibility).