Hello everybody!!<div><br></div><div>Let's assume we have the following code:</div><div><br></div><div>-module(foo).</div><div>bar() -> <<1:3>>.</div><div><br></div><div>In R15B03, calling foo:bar() evaluates to <<1:3>> as we should expect.</div>

<div><br></div><div>Should you compile the module to Core Erlang the resulting code is</div><div><br></div><div><div>'foo'/0 =</div><div>    fun () -></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#{#<1>(3,1,'integer',['unsigned'|['big']])}#</div>

</div><div><br></div><div>and by using the core_scan and core_parse modules the resulting AST in record format of foo is</div><div><br></div><div><div>{c_fun,[],[],</div><div>       {c_binary,[],</div><div>                 [{c_bitstr,[],</div>

<div>                            {c_literal,[],1},</div><div>                            {c_literal,[],3},</div><div>                            {c_literal,[],1},</div><div>                            {c_literal,[],integer},</div>

<div>                            {c_literal,[],[unsigned,big]}}]}}</div></div><div><br></div><div>Having said that, let's try to evaluate the above #c_fun{}.</div><div>#c_fun{} has no parameters so we use an empty set of bindings and we evaluate #c_binary{}.</div>

<div>#c_binary{} evaluates to the concatenation of the [#c_bitstr{}]. We have one #c_bitstr{} so the resulting valu is the value of #c_bitstr{}.</div><div>#c_bitstr{} evaluates to <<1:3/unsigned-big-integer-unit:1>> that equals to <<1:3>> making this the overall value of the #c_fun{}, which is consistent with what we got from the interpreter.</div>

<div><br></div><div>However, in the Core Erlang 1.0.3 language specs, it explicitly says that the number of bits in the resulting value of a #c_binary{} must be divisible by 8 making it a valid Erlang binary. In this case, the #c_binary{} evaluates to the bitstring <<1:3>> which is not a valid binary. So, in theory, we should have raised an exception at this point. But this is not what happens when we evaluate foo:bar/0 in the interpreter.</div>

<div><br></div><div>So is there an inconsistency with the Core Erlang specs or am I missing something?</div><div><br></div><div>Thanks,</div><div>Aggelos</div>