Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
5886-sys_core_fold-Stricten-tests-for-integers....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5886-sys_core_fold-Stricten-tests-for-integers.patch of Package erlang
From 51ee678213119a7f3ea577fbfc57a9c133629ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Thu, 30 Jun 2022 05:17:07 +0200 Subject: [PATCH 6/6] sys_core_fold: Stricten tests for integers --- lib/compiler/src/beam_asm.erl | 2 +- lib/compiler/src/sys_core_fold.erl | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/compiler/src/beam_asm.erl b/lib/compiler/src/beam_asm.erl index 54616e6a51..bbbc844576 100644 --- a/lib/compiler/src/beam_asm.erl +++ b/lib/compiler/src/beam_asm.erl @@ -454,7 +454,7 @@ encode_arg({y, Y}, Dict) when is_integer(Y), Y >= 0 -> encode_arg({atom, Atom}, Dict0) when is_atom(Atom) -> {Index, Dict} = beam_dict:atom(Atom, Dict0), {encode(?tag_a, Index), Dict}; -encode_arg({integer, N}, Dict) when is_integer(N) -> +encode_arg({integer, N}, Dict) -> %% Conservatively assume that all integers whose absolute %% value is greater than 1 bsl 128 will be bignums in %% the runtime system. diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index d79753068f..9021d9eb5c 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -93,6 +93,9 @@ -define(ASSERT(E), ignore). -endif. +-define(MAX_FUNC_ARGS, 255). +-define(IS_FUNC_ARITY(A), is_integer(A) andalso 0 =< A andalso A =< ?MAX_FUNC_ARGS). + %% Variable value info. -record(sub, {v=[], %Variable substitutions s=sets:new([{version, 2}]) :: sets:set(), %Variables in scope @@ -1866,6 +1869,7 @@ case_opt_data_2(P, TypeSig, Bs0) -> {[V|Vs],none} -> {Type,Arity} = TypeSig, Ann = [compiler_generated], + true = ?IS_FUNC_ARITY(Arity), Vars = make_vars(Ann, Arity), Data = cerl:ann_make_data(Ann, Type, Vars), Bs = [{V,Data} | [{Var,V} || Var <- Vs] ++ Bs0], @@ -1923,7 +1927,7 @@ pat_to_expr(P) -> pat_to_expr_list(Ps) -> [pat_to_expr(P) || P <- Ps]. -make_vars(A, Max) -> +make_vars(A, Max) when ?IS_FUNC_ARITY(Max) -> make_vars(A, 1, Max). make_vars(A, I, Max) when I =< Max -> @@ -2443,6 +2447,7 @@ delay_build_1(Core0, TypeSig) -> Core -> {Type,Arity} = TypeSig, Ann = [compiler_generated], + true = ?IS_FUNC_ARITY(Arity), Vars = make_vars(Ann, Arity), Data = cerl:ann_make_data(Ann, Type, Vars), {yes,Vars,Core,Data} -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor