I was going through assembly code optimization manual section 2.3 Common coding pitfalls - page 9
Unmatched PUSH and POP instructions. The number of PUSH and POP instructions must be equal for all possible paths through a function. Example:
push ebx test ecx, ecx jz Finished ... pop ebx Finished: ; Wrong! Label should be before pop ebx retHere, the value of EBX that is pushed is not popped again if ECX is zero. The result is that the RET instruction will pop the former value of EBX and jump to a wrong address.
My doubt is: doesn't the jz instruction store the return address in the stack? What about other instructions like jmp, jg, jge, jl, jle etc?
calldoes. - fuz