[erlang-bugs] VM crash when using a matched binary as function

Björn Gustavsson <>
Wed Feb 5 17:25:03 CET 2014


On Wed, Feb 5, 2014 at 4:04 PM, Loïc Hoguin <> wrote:

> Hello,
>
> The following code crashes the VM:
>
>
> -module(crashing).
> -compile(export_all).
>
> crash(Bin) ->
>         crash(Bin, <<>>).
>
> crash(<<>>, Acc) ->
>         Acc;
> crash(<< C, Rest/bits >>, Acc) ->
>         %% There is no crash if we print the variable Rest before using it.
>         %% Uncomment to see the difference.
>         % io:format("~p~n", [Rest]),
>         Rest(<< Acc/binary, C >>).
>
>
Thanks for the bug report. Will fix (in the compiler).

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140205/66872e58/attachment.html>


More information about the erlang-bugs mailing list