The cleanup I did was relatively late in the game (1988) and was done
to the Ninth Edition Unix sh. My stak.c is available at my web page
(www.collyer.net/who/geoff) but the fixes didn't get back into most
shells (Cray may have picked them up).
As I noted in the corresponding paper, A Partial Tour Through the UNIX
Shell,
The shell was the last program ported to the Interdata during
the original UNIX port, due to the difficulty of getting the
details of restarting faulting instructions just right, which
is why the Seventh Edition (also known as ``V7'') distribution
tape includes /bin/osh, the Sixth Edition shell.