In no case (not intVal, not intRef, and not intPtr) does i
necessarily stick around after foo returns.
The value on the stack which was previously occupied by i may or may not be changed at any time, after foo returns.
For example (on some CPUs and O/Ses), it is likely to be changed by any subsequent call to a subroutine, and may be changed if a hardware interrupt occurs.