From 35f6804946b22ef9a813c27780d4760c157a3c3d Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 3 Mar 2014 14:12:20 +0100 Subject: Properly collect labels in put_map instructions in beam_jump Reported-by: Ulf Norell --- lib/compiler/src/beam_jump.erl | 1 + lib/compiler/test/map_SUITE.erl | 3 +++ 2 files changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/compiler/src/beam_jump.erl b/lib/compiler/src/beam_jump.erl index 0fc8d45c80..00b38637c1 100644 --- a/lib/compiler/src/beam_jump.erl +++ b/lib/compiler/src/beam_jump.erl @@ -446,6 +446,7 @@ is_label_used_in_2({set,_,_,Info}, Lbl) -> case Info of {bif,_,{f,F}} -> F =:= Lbl; {alloc,_,{gc_bif,_,{f,F}}} -> F =:= Lbl; + {alloc,_,{put_map,_,{f,F}}} -> F =:= Lbl; {'catch',{f,F}} -> F =:= Lbl; {alloc,_,_} -> false; {put_tuple,_} -> false; diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl index 3639192a51..115ba25525 100644 --- a/lib/compiler/test/map_SUITE.erl +++ b/lib/compiler/test/map_SUITE.erl @@ -287,6 +287,7 @@ get_val(#{ val := V }) -> {some_val, V}. t_guard_bifs(Config) when is_list(Config) -> true = map_guard_empty(), + true = map_guard_empty_2(), true = map_guard_head(#{a=>1}), false = map_guard_head([]), true = map_guard_body(#{a=>1}), @@ -297,6 +298,8 @@ t_guard_bifs(Config) when is_list(Config) -> map_guard_empty() when is_map(#{}); false -> true. +map_guard_empty_2() when true; #{} andalso false -> true. + map_guard_head(M) when is_map(M) -> true; map_guard_head(_) -> false. -- cgit v1.2.3