[erlang-bugs] maps used as map keys crash BEAM compiler

Björn-Egil Dahlberg <>
Wed Apr 2 16:49:34 CEST 2014


Thanks for reporting!

On 2014-04-02 15:57, Kostis Sagonas wrote:
> In playing with map support for native code we run into the following 
> compiler bug (this refers to the current -- and supposedly frozen for 
> 17.0, but I hope bug fixes are still possible to be included to it -- 
> 'master' branch)
>
>   -module(pmatch_map_key_bug).
>   -export([foo/1]).
>
>   foo(#{#{} := 42}) -> true;
>   foo(_) -> false.
>
> $ erlc pmatch_map_key_bug.erl
> pmatch_map_key_bug.erl: internal error in core_module;
> crash reason: function_clause
>
>   in function  core_lib:literal_value/1
>   in call from v3_core:'-pattern_map_pairs/2-anonymous-0-'/3
>   in call from lists:mapfoldl/3
>   in call from v3_core:pattern_map_pairs/2
>   in call from v3_core:pattern/2
>   in call from v3_core:'-pattern_list/2-lc$^0/1-0-'/2
>   in call from v3_core:clause/2
>   in call from v3_core:clauses/2
>
>
> I suggest the BEAM compiler should consistently make up its mind 
> whether maps are literals or not.
>
> Kostis
>
> PS. Thanks to @margnus1 for the original bug report.
> PS2. Apologies if this ends up twice on the mailing list; sent from a 
> different mail address first.
> _______________________________________________
> erlang-bugs mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-bugs
>
>



More information about the erlang-bugs mailing list