[MLton] deepFlatten exception
Matthew Fluet
fluet@cs.cornell.edu
Tue, 13 Jun 2006 11:49:58 -0400 (EDT)
>> While compiling a program using the command
>>
>> mlton -verbose 3 -runtime 'ram-slop 0.4' t.mlb
>>
>> quite a bit of output is produced (see attached log file) with this at the
>> end:
>>
>> deepFlatten starting
>> deepFlatten raised in 0.11 + 0.00 (0% GC)
>> ssa2Simplify raised in 0.35 + 0.00 (0% GC)
>> pre codegen raised in 28.94 + 5.17 (15% GC)
>> Compile SML raised in 28.94 + 5.17 (15% GC)
>> MLton raised in 28.94 + 5.17 (15% GC)
>> DeepFlatten.replaceVar x_0
>>
>> Is this a compiler bug, or something wrong with my program?
>
> It is a compiler bug. Any errors after the parseAndElaborate (i.e., SML
> type-checking) phase are indicative of compiler bugs. (It might be a good
> idea for us to change the exception printer to explicitly state that the
> error should be reported to mlton@mlton.org as a compiler bug.)
I should have also mentioned that you can work around the compiler bug by
instructing the compiler to drop the offending optimization pass:
mlton -verbose 3 -runtime 'ram-slop 0.4' -drop-pass deepFlatten t.mlb
I'm able to successfully compile the test program with the above command
line.
When one encounters a compiler bug like this, it is also useful to compile
with the '-type-check true' option, which instructs the compiler to type
check the intermediate languages after each transformation and
optimization pass. This is useful because some compiler bugs will result
in a type incorrect program; it can also be useful to pinpoint where the
compilation went wrong.
Unfortunately, none of this applies to this bug; the SSA2 program into
deepFlatten type checks.