[erlang-bugs] Compiler internal error on "case {<exp>}"

Erik Søe Sørensen ess@REDACTED
Thu Jan 23 23:41:22 CET 2014


Hi all,
I'd like to report a bug in the Erlang (R16B) compiler - it crashes on 
code like

    foo(X) ->
         case {X+1} of
             1 -> ok
         end.

(not that that code makes any sense anyway, of course).
The error message is:

    Function: foo/1
    erlcbug.erl:none: internal error in beam_except;
    crash reason: {{case_clause,
                        {'EXIT',
                            {{badmatch,
    [{set,[],[],{line,[{location,"erlcbug.erl",4}]}},
                                  {set,
                                      [{x,0}],
                                      [{x,0},{integer,1}],
                                      {alloc,1,{gc_bif,'+',{f,0}}}},
    {set,[],[],{alloc,1,{nozero,nostack,5,[]}}},
                                  {set,[{x,1}],[],{put_tuple,1}},
                                  {set,[],[{x,0}],put}]},
                             [{beam_except,fix_block,2,
    [{file,"beam_except.erl"},{line,138}]},
                              {beam_except,translate_exception,4,
    [{file,"beam_except.erl"},{line,130}]},
                              {beam_except,dig_out,2,
    [{file,"beam_except.erl"},{line,98}]},
                              {beam_except,translate_1,5,
    [{file,"beam_except.erl"},{line,78}]},
                              {beam_except,function,1,
    [{file,"beam_except.erl"},{line,41}]},
                              {beam_except,'-module/2-lc$^0/1-0-',1,
    [{file,"beam_except.erl"},{line,36}]},
                              {beam_except,module,2,
    [{file,"beam_except.erl"},{line,36}]},
    {compile,'-select_passes/2-anonymous-2-',2,
    [{file,"compile.erl"},{line,469}]}]}}},
                    [{compile,'-select_passes/2-anonymous-2-',2,
                         [{file,"compile.erl"},{line,469}]},
                     {compile,'-internal_comp/4-anonymous-1-',2,
                         [{file,"compile.erl"},{line,269}]},
    {compile,fold_comp,3,[{file,"compile.erl"},{line,287}]},
    {compile,internal_comp,4,[{file,"compile.erl"},{line,271}]},
    {compile,internal,3,[{file,"compile.erl"},{line,246}]}]}


As for narrowing down the cause and extent, I can report that all of the 
variants

    bar(X) ->
         case {X} of
             1 -> ok
         end.

    baz(X) ->
         case {X+1} of
             {1} -> ok
         end.

    quux(X) ->
         case {ext:f(X)} of
             1 -> ok
         end.

    supercalifragilisticexpialidocious(X) ->
         case {[X]} of
             1 -> ok
         end.

compile just fine, while

    antidisestablishmentarianism(X) ->
         case {-X} of
             1 -> ok
         end.

    baz2(X) ->
         case {X+1} of
             {1,2} -> ok
         end.

also trigger the bug.
(So apart from a tuple type mismatch, apparently a unary or binary 
operation must be included; the original triggering example featured 
"band".)

Regards,
Erik Søe Sørensen
-- 
Mobile: + 45 26 36 17 55 | Skype: eriksoesorensen | Twitter: @eriksoe
Trifork A/S  |  Margrethepladsen 4  |  DK-8000 Aarhus C | 
www.trifork.com <http://www.trifork.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140123/5e38c3b9/attachment.htm>


More information about the erlang-bugs mailing list