nontail Bug continuations
Stephen Weeks
MLton@sourcelight.com
Fri, 9 Nov 2001 17:08:44 -0800
I just fixed a weird bug caused by the interaction of removeUnused and
the shrinker. RemoveUnused changes unreachable continuations into Bug
continuations. For example, it will change the following function
fun loop () = L ()
L () =
K (loop ())
K () = ()
into
fun loop () = L ()
L () =
K (loop ())
K () = Bug
because it proves that loop can never return. The unfortunate
consequence of this is the pass in the shrinker that turns tontail
calls into tail calls when all the continuation does is return. So,
the shrinker would simplify the first function above, but not the
second.
This caused an out of memory bug on timeout.sml due to a loop that
should have been tail, but was nontail.
The fix I put in was to turn nontail calls with Bug continuations into
tail calls, provided the types work out.