aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2014-03-01 17:40:15 +0100
committerAnthony Ramine <[email protected]>2014-03-03 01:35:10 +0100
commit1336d7879f9a722abda1fe8bc520953c5a079c79 (patch)
tree827a764d68db352f3130ad79029e7b304b2409b9 /lib/compiler/src
parenta74e66a68f3b4ed590f928b4fd4f0808c6287a32 (diff)
downloadotp-1336d7879f9a722abda1fe8bc520953c5a079c79.tar.gz
otp-1336d7879f9a722abda1fe8bc520953c5a079c79.tar.bz2
otp-1336d7879f9a722abda1fe8bc520953c5a079c79.zip
Do not mark all calls to erlang:is_function/2 as safe
Calls to erlang:is_function/2 where the second is not a literal nonnegative integer can crash at runtime and thus can't be marked as safe.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/sys_core_fold.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl
index eb9c302334..fb8a6174a7 100644
--- a/lib/compiler/src/sys_core_fold.erl
+++ b/lib/compiler/src/sys_core_fold.erl
@@ -2356,6 +2356,15 @@ is_safe_bool_expr_1(#c_call{module=#c_literal{val=erlang},
%% been rewritten to is_record(Expr, LiteralTag, TupleSize).
false;
is_safe_bool_expr_1(#c_call{module=#c_literal{val=erlang},
+ name=#c_literal{val=is_function},
+ args=[A,#c_literal{val=Arity}]},
+ Sub, _BoolVars) when is_integer(Arity), Arity >= 0 ->
+ is_safe_simple(A, Sub);
+is_safe_bool_expr_1(#c_call{module=#c_literal{val=erlang},
+ name=#c_literal{val=is_function}},
+ _Sub, _BoolVars) ->
+ false;
+is_safe_bool_expr_1(#c_call{module=#c_literal{val=erlang},
name=#c_literal{val=Name},args=Args},
Sub, BoolVars) ->
NumArgs = length(Args),