inst in your example won't be allocated on stack. It will be allocated somewhere in .data or .bss section. Otherwise this static variable couldn't live all the time program executes, and so it couldn't have the same value, which was before, each time you enter this function.