[MLton] Closure-convert bug
Wed, 13 Jul 2005 08:15:31 -0400 (EDT)
On Wed, 13 Jul 2005, Wesley W. Terpstra wrote:
> terpstra@dakar:~$ ./mlton/build/bin/mlton
> MLton MLTONVERSION (built Wed Jul 13 12:57:45 2005 on dakar)
> terpstra@dakar:~$ cat bug.sml
> val x = ref (fn _ => ())
> val () = x := (fn x => (x andalso true; ()))
> val y = MLton.Weak.new (!x)
> val z = MLton.Weak.get y
> val _ = if isSome z then print "Resident\n" else print "Cleared\n"
> terpstra@dakar:~$ ./mlton/build/bin/mlton bug.sml
> AbstractValue.fromType: non-arrow
Actually, the bug is in closure converion's flow analysis pass.
(Compiling with -verbose 2 will let you see which pass raised an
error.) The fact that the bug is tickled in closure conversion isn't too
surprising, since you are trying to make a weak pointer to a closure.