[erlang-bugs] Internal consistency check failed in compiler

Justin T. Sampson <>
Sat Apr 5 20:06:05 CEST 2008


Using R12B-0 on Mac OS X 10.4.11...

$ erlc bug_test.erl
bug_test: function process/2+25:
  Internal consistency check failed - please report this bug.
  Instruction: {bs_append,{f,0},
                          {integer,0},
                          0,2,8,
                          {x,0},
                          {field_flags,[]},
                          {x,2}}
  Error:       {match_context,{x,0}}:

===== bug_test.erl =====
-module(bug_test).
-compile(export_all).

escape_char($<) ->
    <<"<">>;
escape_char($>) ->
    <<">">>;
escape_char($&) ->
    <<"&">>;
escape_char(C) when C =:= $\t; C =:= $\r; C =:= $\n; C >= $\s, C =< $~ ->
    <<C>>;
escape_char(C) when C >= 128 ->
    <<"&#", (list_to_binary(integer_to_list(C)))/binary, ";">>.

process(<<>>, SoFar) ->
    SoFar;
process(<<"\r\n", Rest/binary>>, SoFar) ->
    process(Rest, <<SoFar/binary, "<br />\n">>);
process(<<"\r", Rest/binary>>, SoFar) ->
    process(Rest, <<SoFar/binary, "<br />\n">>);
process(<<"\n", Rest/binary>>, SoFar) ->
    process(Rest, <<SoFar/binary, "<br />\n">>);
process(<<"  ", Rest/binary>>, SoFar) ->
    process(<<" ", Rest/binary>>, <<SoFar/binary, " ">>);
process(<<" ", Rest/binary>>, SoFar) ->
    process(<<Rest/binary>>, <<SoFar/binary, " ">>);
process(<<"\t", Rest/binary>>, SoFar) ->
    process(<<Rest/binary>>, <<SoFar/binary, "    ">>);
process(<<"----\r\n", Rest/binary>>, SoFar) ->
    process(<<Rest/binary>>, <<SoFar/binary, "<hr />\n">>);
process(<<"----\r", Rest/binary>>, SoFar) ->
    process(<<Rest/binary>>, <<SoFar/binary, "<hr />\n">>);
process(<<"----\n", Rest/binary>>, SoFar) ->
    process(<<Rest/binary>>, <<SoFar/binary, "<hr />\n">>);
process(<<C, Rest/binary>>, SoFar) ->
    process(Rest, <<SoFar/binary, (escape_char(C))/binary>>).
===== end bug_test.erl =====



More information about the erlang-bugs mailing list