From d10fd4596270d7f8503dc46a0a7c229ad08795d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 29 Jun 2018 14:14:40 +0200 Subject: Eliminate a crash in the beam_jump pass https://bugs.erlang.org/browse/ERL-660 --- lib/compiler/test/beam_utils_SUITE.erl | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'lib/compiler/test') diff --git a/lib/compiler/test/beam_utils_SUITE.erl b/lib/compiler/test/beam_utils_SUITE.erl index 3d35b546fc..dee7fb9cf9 100644 --- a/lib/compiler/test/beam_utils_SUITE.erl +++ b/lib/compiler/test/beam_utils_SUITE.erl @@ -25,7 +25,8 @@ is_not_killed/1,is_not_used_at/1, select/1,y_catch/1,otp_8949_b/1,liveopt/1,coverage/1, y_registers/1,user_predef/1,scan_f/1,cafu/1, - receive_label/1,read_size_file_version/1,not_used/1]). + receive_label/1,read_size_file_version/1,not_used/1, + is_used_fr/1]). -export([id/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. @@ -52,7 +53,8 @@ groups() -> scan_f, cafu, read_size_file_version, - not_used + not_used, + is_used_fr ]}]. init_per_suite(Config) -> @@ -527,5 +529,24 @@ not_used_p(_C, S, K, L) when is_record(K, k) -> id(K) end. +is_used_fr(Config) -> + 1 = is_used_fr(self(), self()), + 1 = is_used_fr(self(), other), + receive 1 -> ok end, + receive 1 -> ok end, + receive 1 -> ok end, + receive 1 -> ok end, + ok. + +is_used_fr(X, Y) -> + %% beam_utils:is_used({fr,R}, Code) would crash. + _ = 0 / (X ! 1), + _ = case Y of + X -> ok; + _ -> error + end, + X ! 1. + + %% The identity function. id(I) -> I. -- cgit v1.2.3