[erlang-questions] bug: R12B-0 internal consistency check

Mateusz Berezecki mateuszb@REDACTED
Sat Dec 22 23:40:15 CET 2007


On Dec 22, 2007, at 11:02 PM, Fredrik Svahn wrote:

> See http://erlang.org/pipermail/erlang-bugs/2007-December/000569.html
>
> Add a TypeSpecifier to get past the compilation error:
>
> intersection(<<A:1, Map1/bits>>, <<A:1,Map2/bits>>, K, Acc) ->
>        intersection(<<Map1/bits>>, <<Map2/bits>>, K+1, [K|Acc]);
>
> intersection(<<A:1, Map1/bits>>, <<B:1, Map2/bits>>, K, Acc) ->
>        intersection(<<Map1/bits>>, <<Map2/bits>>, K+1, [K|Acc]);
>
> BR /Fredrik


I just got another error:

the code is :

-module (bitmap).

-export ([gen_bit/2]).
-export ([intersection/4]).

gen_bit(0, Acc) -> Acc;
gen_bit(N, Acc) when is_integer(N), N > 0 -> gen_bit(N-1, <<Acc/ 
binary, (random:uniform(2)-1):1>>).


intersection(<<>>, <<>>, _, Acc) -> Acc;
intersection(<<A:1, Rest1/bits>>, <<A:1, Rest2/bits>>, K, Acc) ->
	intersection(<<Rest1/bits>>, <<Rest2/bits>>, K+1, [K | Acc]);
	
intersection(<<A:1, Rest1/bits>>, <<B:1, Rest2/bits>>, K, Acc) ->
	intersection(<<Rest1/bits>>, <<Rest2/bits>>, K+1, Acc).


the error while compiling is:

$ erlc bitmap.erl
bitmap: function intersection/4+21:
   Internal consistency check failed - please report this bug.
   Instruction: {bs_append,{f,0},
                           {integer,0},
                           0,9,1,
                           {x,5},
                           {field_flags,[]},
                           {x,0}}
   Error:       {match_context,{x,5}}:


It compiles fine when replacing

<<Rest1/bits>> to Rest1 and <<Rest2/bits>> to Rest2


Mateusz



More information about the erlang-questions mailing list