bug report
Stephen Weeks
MLton@sourcelight.com
Mon, 8 Oct 2001 10:01:57 -0700
The following benchmark tickles a compiler bug
http://www.sourcelight.com/MLton/benchmarks/tyan.sml
--------------------------------------------------------------------------------
ML Kit version 4.0.0, Sep 21, 2001 [X86 Backend]
[reading source file: tyan.sml]
Impossible: LambdaBasics.mk_subst: 1 tyvars, 0 types; CompileDec.APPexp.LVAR(sub)
.............
ElabInfo{
ParseInfo{
SourceInfo(
POSITION("tyan.sml",line 114,column 40," fun swap (i,j) = let val ai = a sub i
"),
POSITION("tyan.sml",line 114,column 47," fun swap (i,j) = let val ai = a sub i
")
);
_|_
};
_|_;
VAR_INFO('U103382);
_|_
}Cannot find lvar sub in compiler environment:
CENV(
StrEnv =
{
Word ->
CENV(
StrEnv = {},
VarEnv =
{
toInt -> LVAR(toInt, all().(<word>-><int>), il),
andb -> LVAR(andb, all().(<(word*word)>-><word>), il),
fromInt -> LVAR(fromInt, all().(<int>-><word>), il),
orb -> LVAR(orb, all().(<(word*word)>-><word>), il),
<< -> LVAR(<<, all().(<(word*word)>-><word>), il),
>> -> LVAR(>>, all().(<(word*word)>-><word>), il)
},
TyEnv = {}
),
TextIO ->
CENV(
StrEnv = {},
VarEnv =
{
inputLine -> LVAR(inputLine, all().(<(int*string)>-><string>), il),
endOfStream -> LVAR(endOfStream, all().(<(int*string)>-><bool>), il),
openIn -> LVAR(openIn, all().(<string>-><(int*string)>), il),
closeIn -> LVAR(closeIn, all().(<(int*string)>-><{}>), il),
flushOut -> LVAR(flushOut, all().(<(string*int)>-><{}>), il),
stdOut -> LVAR(stdOut, all().(string*int), il)
},
TyEnv = {}
),
String ->
CENV(
StrEnv = {},
VarEnv =
{
explode -> LVAR(explode, all().(<string>-><word list>), il),
implode -> LVAR(implode, all().(<word list>-><string>), il),
concat -> LVAR(concat, all().(<string list>-><string>), il)
},
TyEnv = {}
),
List ->
CENV(
StrEnv = {},
VarEnv =
{
foldl ->
LVAR(foldl, all('a50,'a52).(<(<('a50*'a52)>-><'a52>)>-><(<'a52>-><(<'a50 list>-><'a52>)>)>), il),
foldr ->
LVAR(foldr, all('a4c,'a4e).(<(<('a4c*'a4e)>-><'a4e>)>-><(<'a4e>-><(<'a4c list>-><'a4e>)>)>), il)
},
TyEnv = {}
),
Int ->
CENV(
StrEnv = {},
VarEnv =
{
max -> LVAR(max, all().(<(int*int)>-><int>), il),
toString -> LVAR(toString, all().(<int>-><string>), il)
},
TyEnv = {}
),
Char ->
CENV(StrEnv = {},VarEnv = {toString -> LVAR(toString, all().(<word>-><string>), il)},TyEnv = {}),
Array ->
CENV(
StrEnv = {},
VarEnv =
{
sub -> LVAR(sub, all('ac2).(<('ac2 word_table ref*int)>-><'ac2>), il),
update -> LVAR(update, all('ac0).(<('ac0 word_table ref*int*'ac0)>-><{}>), il),
array -> LVAR(array, all('aca).(<(int*'aca)>-><'aca word_table ref>), il),
length -> LVAR(length, all('ac4).(<'ac4 word_table ref>-><int>), il)
},
TyEnv = {array -> ([ref,word_table], ce)}
)
},
VarEnv =
{
j -> LVAR(j, all().int, il),
i -> LVAR(i, all().int, il),
swap -> LVAR(swap, all().(<(int*int)>-><{}>), il),
update -> LVAR(update, all('a22,'a24).(<('a24 word_table ref*int*'a24)>-><{}>), il),
sub -> LVAR(sub, all('a22,'a24).(<('a22 word_table ref*int)>-><'a22>), il),
a -> LVAR(a, all().'a20 word_table ref, il),
compare -> LVAR(compare, all().(<('a20*'a20)>-><relation>), il),
stripSort ->
LVAR(stripSort, all().(<(<('a20*'a20)>-><relation>)>-><(<'a20 word_table ref>-><'a20 list>)>), il),
insert ->
LVAR(insert, all('a1e).(<('a1e*int*'a1e list word_table ref)>-><'a1e list word_table ref>), il),
illegal -> LVAR(illegal, all('a1c).(<string>-><'a1c>), il),
impossible -> LVAR(impossible, all('a1a).(<string>-><'a1a>), il),
notImplemented -> LVAR(notImplemented, all('a18).(<string>-><'a18>), il),
error -> LVAR(error, all('a14,'a16).(<(<'a14>-><exn>)>-><(<'a14>-><'a16>)>), il),
Illegal -> EXCON(Illegal),
Impossible -> EXCON(Impossible),
NotImplemented -> EXCON(NotImplemented),
Greater -> CON(Greater),
Equal -> CON(Equal),
Less -> CON(Less),
arrayoflist -> LVAR(arrayoflist, all('a12).(<'a12 list>-><'a12 word_table ref>), il),
ArrayofList -> EXCON(ArrayofList),
tabulate -> LVAR(tabulate, all('a10).(<(int*(<int>-><'a10>))>-><'a10 word_table ref>), il),
Tabulate -> EXCON(Tabulate),
smlnj_div -> LVAR(smlnj_div, all().(<(int*int)>-><int>), il),
smlnj_mod -> LVAR(smlnj_mod, all().(<(int*int)>-><int>), il),
close_in -> LVAR(close_in, all().(<(int*string)>-><{}>), il),
open_in -> LVAR(open_in, all().(<string>-><(int*string)>), il),
end_of_stream -> LVAR(end_of_stream, all().(<(int*string)>-><bool>), il),
input_line -> LVAR(input_line, all().(<(int*string)>-><string>), il),
revfold ->
LVAR(revfold, all('ac,'ae).(<(<('ac*'ae)>-><'ae>)>-><(<'ac list>-><(<'ae>-><'ae>)>)>), il),
fold -> LVAR(fold, all('a8,'aa).(<(<('a8*'aa)>-><'aa>)>-><(<'a8 list>-><(<'aa>-><'aa>)>)>), il),
>> -> LVAR(>>, all().(<(int*int)>-><int>), il),
<< -> LVAR(<<, all().(<(int*int)>-><int>), il),
|| -> LVAR(||, all().(<(int*int)>-><int>), il),
&& -> LVAR(&&, all().(<(int*int)>-><int>), il),
length1 -> LVAR(length1, all('a6).(<'a6 word_table ref>-><int>), il),
array1 -> LVAR(array1, all('a4).(<(int*'a4)>-><'a4 word_table ref>), il),
update1 -> LVAR(update1, all('a2).(<('a2 word_table ref*int*'a2)>-><{}>), il),
sub1 -> LVAR(sub1, all('a0).(<('a0 word_table ref*int)>-><'a0>), il),
print -> LVAR(print, all().(<string>-><{}>), il),
^ -> LVAR(^, all().(<(string*string)>-><string>), il),
not -> LVAR(not, all().(<bool>-><bool>), il),
null -> LVAR(null, all('a7e).(<'a7e list>-><bool>), il),
app -> LVAR(app, all('a8a).(<(<'a8a>-><{}>)>-><(<'a8a list>-><{}>)>), il),
:= -> LVAR(:=, all('a20).(<('a20 ref*'a20)>-><{}>), il),
! -> LVAR(!, all('a22).(<'a22 ref>-><'a22>), il),
ref -> REF,
NONE -> CON(NONE),
SOME -> CON(SOME),
> -> GREATER,
@ -> LVAR(@, all('a88).(<('a88 list*'a88 list)>-><'a88 list>), il),
ord -> LVAR(ord, all().(<word>-><int>), il),
chr -> LVAR(chr, all().(<int>-><word>), il),
map -> LVAR(map, all('a8c,'a8e).(<(<'a8c>-><'a8e>)>-><(<'a8c list>-><'a8e list>)>), il),
Div -> EXCON(Div),
* -> MUL,
>= -> GREATEREQ,
= -> LVAR(=, all(''a1).(<(''a1*''a1)>-><bool>), il),
- -> MINUS,
nil -> CON(nil),
length -> LVAR(length, all('a84).(<'a84 list>-><int>), il),
:: -> CON(::),
<= -> LESSEQ,
< -> LESS,
+ -> PLUS,
false -> CON(false),
true -> CON(true),
div -> DIV,
mod -> MOD
},
TyEnv = {
relation -> ([relation], ce),
array1 -> ([ref,word_table], ce),
ref -> ([ref], ce),
option -> ([option], ce),
list -> ([list], ce),
int -> ([int], ce),
unit -> ([], ce),
string -> ([string], ce)
}
)Impossible: CompileDec.lookup_error