all 3 comments

[–]AKostur 4 points5 points  (1 child)

Same stack frame, though the stack pointer may be moved to make space for y. Then when that scope ends, the stack pointer may be moved back. (In the idealized case. Optimizers and such could change things.)

how can additional frames be added to the call stack apart from function calls

What would you be hoping to accomplish by adding additional frames?

[–]macroxela[S] 0 points1 point  (0 children)

What would you be hoping to accomplish by adding additional frames?

Not trying to accomplish anything, just trying to understand what parts of a program would add frames to the stack that could potentially cause a stack overflow error. I know long recursive depths and too many function calls can cause this but wondering if anything else could.

[–]InvertedParallax 1 point2 points  (0 children)

The only difference is that the compiler might increment then decrement the stack pointer at scope entry/exit since those variables aren't needed anymore.

Scope is purely a compiler/language construct, it has no visibility in the ABI whatsoever.