aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-11-20 13:05:51 +0100
committerBjörn Gustavsson <[email protected]>2018-11-20 13:13:26 +0100
commit8be2c32fe0534d863c6ce6d7665011a162fc39ec (patch)
tree12d3b632309c54cadfdfb74a9239619e52e076c4 /lib/compiler/src
parentd743f51960384dd17ae3cb905ec57e8012c3abd7 (diff)
downloadotp-8be2c32fe0534d863c6ce6d7665011a162fc39ec.tar.gz
otp-8be2c32fe0534d863c6ce6d7665011a162fc39ec.tar.bz2
otp-8be2c32fe0534d863c6ce6d7665011a162fc39ec.zip
Fix internal consistency failure for is_function/2
There could be an internal consistency failure when using is_function/2, because an optimization did not take into account that is_function/2 can fail. https://bugs.erlang.org/browse/ERL-778
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_utils.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index 6e23003fc7..6b2ab5a2a4 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -745,8 +745,11 @@ check_liveness_block_2(R, {gc_bif,Op,{f,Lbl}}, Ss, St) ->
check_liveness_block_3(R, Lbl, {Op,length(Ss)}, St);
check_liveness_block_2(R, {bif,Op,{f,Lbl}}, Ss, St) ->
Arity = length(Ss),
+
+ %% Note that is_function/2 is a type test but is not safe.
case erl_internal:comp_op(Op, Arity) orelse
- erl_internal:new_type_test(Op, Arity) of
+ (erl_internal:new_type_test(Op, Arity) andalso
+ erl_bifs:is_safe(erlang, Op, Arity)) of
true ->
{killed,St};
false ->