[erlang-questions] erlang 21 binary matching bug in functin definition

Brujo Benavides elbrujohalcon@REDACTED
Fri Aug 3 18:48:05 CEST 2018


Yeah, you’re right Michał! :)

In OTP20 it works…

Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V9.1  (abort with ^G)
1> c(a), a:err(<<0>>).
{0,<<>>}
2>

格通: I think you should report the bug <http://bugs.erlang.org/> :)

Brujo Benavides <http://about.me/elbrujohalcon>



> On 3 Aug 2018, at 13:45, Michał Muskała <michal@REDACTED> wrote:
> 
> On 3 Aug 2018, 18:32 +0200, Brujo Benavides <elbrujohalcon@REDACTED>, wrote:
>> Well, that’s not happening here…
>>  
> 
> I think you simplified the function too much, so it doesn't trigger the bug in the compiler anymore. I can reproduce the bug with a somewhat simpler code:
> 
> 
> -module(a).
> 
> -export([err/2]).
> 
> err(_, <<Length, Data/binary>>) ->
>     case {Length, Data} of
>         {0, _} -> Data;
>         {4, <<Rest/binary>>} -> Rest
>     end.
> 
> Calling a:err(1, <<0>>) returns <<0>>. That's on 21.0.2
> 
> Michał.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180803/e225bf2a/attachment.htm>


More information about the erlang-questions mailing list