summaryrefslogtreecommitdiff
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2023-04-28 10:21:32 +0200
committerBjörn Gustavsson <bjorn@erlang.org>2023-04-28 12:44:32 +0200
commitf9b1ee13b38c0f2b5d327e0d051e52cd5b2b0f17 (patch)
tree1158a16d8ffbac3c7792404eb8e915c5c3ffd571 /lib/compiler/src
parent86e6ebf531e2bd6222a7a29a422b704cd10a88be (diff)
downloaderlang-f9b1ee13b38c0f2b5d327e0d051e52cd5b2b0f17.tar.gz
Eliminate crash in beam_ssa_type
Closes #7179
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_call_types.erl17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/compiler/src/beam_call_types.erl b/lib/compiler/src/beam_call_types.erl
index 8b9cb836fd..697566cecb 100644
--- a/lib/compiler/src/beam_call_types.erl
+++ b/lib/compiler/src/beam_call_types.erl
@@ -365,12 +365,19 @@ types(erlang, is_boolean, [Type]) ->
types(erlang, is_float, [Type]) ->
sub_unsafe_type_test(Type, #t_float{});
types(erlang, is_function, [Type, #t_integer{elements={Arity,Arity}}])
- when Arity >= 0, Arity =< ?MAX_FUNC_ARGS ->
+ when is_integer(Arity) ->
RetType =
- case meet(Type, #t_fun{arity=Arity}) of
- Type -> #t_atom{elements=[true]};
- none -> #t_atom{elements=[false]};
- _ -> beam_types:make_boolean()
+ if
+ Arity < 0 ->
+ none;
+ 0 =< Arity, Arity =< ?MAX_FUNC_ARGS ->
+ case meet(Type, #t_fun{arity=Arity}) of
+ Type -> #t_atom{elements=[true]};
+ none -> #t_atom{elements=[false]};
+ _ -> beam_types:make_boolean()
+ end;
+ Arity > ?MAX_FUNC_ARGS ->
+ #t_atom{elements=[false]}
end,
sub_unsafe(RetType, [any, any]);
types(erlang, is_function, [Type]) ->