Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang
erlang
0659-beam_ssa_type-Fix-environment-check-in-loc...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0659-beam_ssa_type-Fix-environment-check-in-local-fun-cal.patch of Package erlang
From 72ac13a7a6b5c5eab5de737e0f0cc2c7ad4d7356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org> Date: Wed, 27 Mar 2024 15:00:33 +0100 Subject: [PATCH] beam_ssa_type: Fix environment check in local fun call optimization --- lib/compiler/src/beam_ssa_type.erl | 4 ++-- lib/compiler/test/fun_SUITE.erl | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/compiler/src/beam_ssa_type.erl b/lib/compiler/src/beam_ssa_type.erl index d492ed4b50..eaf8e69091 100644 --- a/lib/compiler/src/beam_ssa_type.erl +++ b/lib/compiler/src/beam_ssa_type.erl @@ -330,7 +330,7 @@ sig_fun_call(I0, Args, Ts, Ds, Fdb, Sub, State0) -> CallArgs = CallArgs0 ++ simplify_args(Env, Ts, Sub), I = I0#b_set{args=[Callee | CallArgs]}, sig_local_call(I, Callee, CallArgs, Ts, Fdb, State0); - {#t_fun{target={Name,Arity}}, _} -> + {#t_fun{arity=Arity,target={Name,Arity}}, _} -> %% When a fun lacks free variables, we can make a direct call even %% when we don't know where it was defined. Callee = #b_local{name=#b_literal{val=Name}, @@ -670,7 +670,7 @@ opt_fun_call(#b_set{dst=Dst}=I0, [Fun | CallArgs0], Ts, Ds, Fdb, Sub, Meta) -> CallArgs = CallArgs0 ++ simplify_args(Env, Ts, Sub), I = I0#b_set{args=[Callee | CallArgs]}, opt_local_call(I, Callee, CallArgs, Dst, Ts, Fdb, Meta); - {#t_fun{target={Name,Arity}}, _} -> + {#t_fun{arity=Arity,target={Name,Arity}}, _} -> %% When a fun lacks free variables, we can make a direct call even %% when we don't know where it was defined. Callee = #b_local{name=#b_literal{val=Name}, diff --git a/lib/compiler/test/fun_SUITE.erl b/lib/compiler/test/fun_SUITE.erl index 0d5936824a..e5365b5fa1 100644 --- a/lib/compiler/test/fun_SUITE.erl +++ b/lib/compiler/test/fun_SUITE.erl @@ -24,7 +24,7 @@ test1/1,overwritten_fun/1,otp_7202/1,bif_fun/1, external/1,eep37/1,badarity/1,badfun/1, duplicated_fun/1,unused_fun/1,parallel_scopes/1, - coverage/1]). + coverage/1,leaky_environment/1]). %% Internal exports. -export([call_me/1,dup1/0,dup2/0]). @@ -41,7 +41,7 @@ groups() -> [test1,overwritten_fun,otp_7202,bif_fun,external,eep37, badarity,badfun,duplicated_fun,unused_fun, parallel_scopes, - coverage]}]. + coverage,leaky_environment]}]. init_per_suite(Config) -> test_lib:recompile(?MODULE), @@ -574,5 +574,12 @@ coverage_1() -> ("abc") -> party end, ok. + +leaky_environment(_Config) -> + G = fun(X, Y) -> X + Y end, + F = fun(A) -> G(A, 0) end, + {'EXIT', {{badarity, {F, [1, flurb]}}, _}} = catch F(1, flurb), + ok. + id(I) -> I. -- 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