diff options
author | Anthony Ramine <[email protected]> | 2014-03-03 14:12:20 +0100 |
---|---|---|
committer | Anthony Ramine <[email protected]> | 2014-03-03 14:13:42 +0100 |
commit | 5436de7707970f89ecee7ff649bc8ab6b99f8f36 (patch) | |
tree | 74ada1b3fd29250fb51ff4da4957f63b83c80db1 | |
parent | a74e66a68f3b4ed590f928b4fd4f0808c6287a32 (diff) | |
download | otp-5436de7707970f89ecee7ff649bc8ab6b99f8f36.tar.gz otp-5436de7707970f89ecee7ff649bc8ab6b99f8f36.tar.bz2 otp-5436de7707970f89ecee7ff649bc8ab6b99f8f36.zip |
Properly collect labels in put_map instructions in beam_bool
Reported-by: Ulf Norell
-rw-r--r-- | lib/compiler/src/beam_bool.erl | 2 | ||||
-rw-r--r-- | lib/compiler/test/map_SUITE.erl | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_bool.erl b/lib/compiler/src/beam_bool.erl index 124abd13c1..590665514b 100644 --- a/lib/compiler/src/beam_bool.erl +++ b/lib/compiler/src/beam_bool.erl @@ -318,6 +318,8 @@ split_block_label_used([{set,[_],_,{bif,_,{f,Fail}}}|_], Fail) -> true; split_block_label_used([{set,[_],_,{alloc,_,{gc_bif,_,{f,Fail}}}}|_], Fail) -> true; +split_block_label_used([{set,[_],_,{alloc,_,{put_map,_,{f,Fail}}}}|_], Fail) -> + true; split_block_label_used([_|Is], Fail) -> split_block_label_used(Is, Fail); split_block_label_used([], _) -> false. diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl index b4baef461b..f47a94e033 100644 --- a/lib/compiler/test/map_SUITE.erl +++ b/lib/compiler/test/map_SUITE.erl @@ -279,6 +279,7 @@ get_val(#{ "wazzup" := _, val := V}) -> V; get_val(#{ val := V }) -> {some_val, V}. t_guard_bifs(Config) when is_list(Config) -> + true = map_guard_empty(), true = map_guard_head(#{a=>1}), false = map_guard_head([]), true = map_guard_body(#{a=>1}), @@ -287,6 +288,8 @@ t_guard_bifs(Config) when is_list(Config) -> false = map_guard_pattern("list"), ok. +map_guard_empty() when is_map(#{}); false -> true. + map_guard_head(M) when is_map(M) -> true; map_guard_head(_) -> false. |