<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi all,<br>
I'd like to report a bug in the Erlang (R16B) compiler - it crashes
on code like<br>
<blockquote>foo(X) -><br>
case {X+1} of<br>
1 -> ok<br>
end.<br>
</blockquote>
(not that that code makes any sense anyway, of course).<br>
The error message is:<br>
<blockquote>Function: foo/1<br>
erlcbug.erl:none: internal error in beam_except;<br>
crash reason: {{case_clause,<br>
{'EXIT',<br>
{{badmatch,<br>
[{set,[],[],{line,[{location,"erlcbug.erl",4}]}},<br>
{set,<br>
[{x,0}],<br>
[{x,0},{integer,1}],<br>
{alloc,1,{gc_bif,'+',{f,0}}}},<br>
{set,[],[],{alloc,1,{nozero,nostack,5,[]}}},<br>
{set,[{x,1}],[],{put_tuple,1}},<br>
{set,[],[{x,0}],put}]},<br>
[{beam_except,fix_block,2,<br>
[{file,"beam_except.erl"},{line,138}]},<br>
{beam_except,translate_exception,4,<br>
[{file,"beam_except.erl"},{line,130}]},<br>
{beam_except,dig_out,2,<br>
[{file,"beam_except.erl"},{line,98}]},<br>
{beam_except,translate_1,5,<br>
[{file,"beam_except.erl"},{line,78}]},<br>
{beam_except,function,1,<br>
[{file,"beam_except.erl"},{line,41}]},<br>
{beam_except,'-module/2-lc$^0/1-0-',1,<br>
[{file,"beam_except.erl"},{line,36}]},<br>
{beam_except,module,2,<br>
[{file,"beam_except.erl"},{line,36}]},<br>
{compile,'-select_passes/2-anonymous-2-',2,<br>
[{file,"compile.erl"},{line,469}]}]}}},<br>
[{compile,'-select_passes/2-anonymous-2-',2,<br>
[{file,"compile.erl"},{line,469}]},<br>
{compile,'-internal_comp/4-anonymous-1-',2,<br>
[{file,"compile.erl"},{line,269}]},<br>
{compile,fold_comp,3,[{file,"compile.erl"},{line,287}]},<br>
{compile,internal_comp,4,[{file,"compile.erl"},{line,271}]},<br>
{compile,internal,3,[{file,"compile.erl"},{line,246}]}]}<br>
</blockquote>
<br>
As for narrowing down the cause and extent, I can report that all of
the variants<br>
<blockquote>bar(X) -><br>
case {X} of<br>
1 -> ok<br>
end.<br>
<br>
baz(X) -><br>
case {X+1} of<br>
{1} -> ok<br>
end.<br>
<br>
quux(X) -><br>
case {ext:f(X)} of<br>
1 -> ok<br>
end.<br>
<br>
supercalifragilisticexpialidocious(X) -><br>
case {[X]} of<br>
1 -> ok<br>
end.<br>
</blockquote>
compile just fine, while<br>
<blockquote>antidisestablishmentarianism(X) -><br>
case {-X} of<br>
1 -> ok<br>
end.<br>
<br>
baz2(X) -><br>
case {X+1} of<br>
{1,2} -> ok<br>
end.<br>
</blockquote>
also trigger the bug.<br>
(So apart from a tuple type mismatch, apparently a unary or binary
operation must be included; the original triggering example featured
"band".)<br>
<br>
Regards,<br>
Erik Søe Sørensen<br>
<div class="moz-signature">-- <br>
<div style="color: black; text-align: center;"> <span>Mobile: +
45 26 36 17 55</span> <span> </span> <span style="color:
black; ">| Skype: eriksoesorensen</span> <span> </span> <span
style="color: black; ">| Twitter: @eriksoe</span>
</div>
<div style="text-align: center; color: gray;"> <span>Trifork A/S
| Margrethepladsen 4 | DK-8000 Aarhus C | </span> <a
href="http://www.trifork.com/"><span style="text-decoration:
underline; color: gray;">www.trifork.com</span></a>
</div>
</div>
</body>
</html>