[MLton] bug in refFlatten
Matthew Fluet
fluet@cs.cornell.edu
Thu, 14 Apr 2005 19:31:46 -0400 (EDT)
> There appears to be a subtle bug in the refFlatten pass. The pass seems
> to be sensitive to the ordering of functions in the SSA2 program
> representation. While it would be o.k. (though, less than ideal) to get
> different results depending on the order of functions, in this situation,
> the semantics of the resulting program changes.
>
> The bug is exhibitted by ref-flatten.sml from the regression suite. To
> trigger the bug, write a simple SSA2 that simply reverses the order of
> functions in the program representation. Run this pass immediately before
> the refFlatten pass. The program prints 13 instead of 44.
Alternatively, just add
val functions = List.rev functions
at the top of the refFlatten pass, though a separate reverse pass is a
little easier to turn on/off from the command line.