aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-03-12 12:30:04 +0100
committerBjörn Gustavsson <[email protected]>2014-03-12 12:30:04 +0100
commitafe3f870423c98554efafe8e131ec8fc1de3c18c (patch)
tree6a5b456560c70f26f281089f033a897dc0d07ed0 /lib
parent870737ab657433c5e8751255fe3c4d298202d142 (diff)
parentb08ffc15e1d9ad105dd6385bbac41c97c09b48bc (diff)
downloadotp-afe3f870423c98554efafe8e131ec8fc1de3c18c.tar.gz
otp-afe3f870423c98554efafe8e131ec8fc1de3c18c.tar.bz2
otp-afe3f870423c98554efafe8e131ec8fc1de3c18c.zip
Merge branch 'nox/compiler/v3_core-mismatched-apply'
* nox/compiler/v3_core-mismatched-apply: Do not emit blatantly illformed apply expressions in core_inline
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler/src/cerl_inline.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/compiler/src/cerl_inline.erl b/lib/compiler/src/cerl_inline.erl
index 44293bb8ce..bc9bdc67a4 100644
--- a/lib/compiler/src/cerl_inline.erl
+++ b/lib/compiler/src/cerl_inline.erl
@@ -51,7 +51,7 @@
catch_body/1, clause_body/1, clause_guard/1,
clause_pats/1, clause_vars/1, concrete/1, cons_hd/1,
cons_tl/1, data_arity/1, data_es/1, data_type/1,
- fun_body/1, fun_vars/1, get_ann/1, int_val/1,
+ fname_arity/1, fun_body/1, fun_vars/1, get_ann/1, int_val/1,
is_c_atom/1, is_c_cons/1, is_c_fname/1, is_c_int/1,
is_c_list/1, is_c_seq/1, is_c_tuple/1, is_c_var/1,
is_data/1, is_literal/1, is_literal_term/1, let_arg/1,
@@ -1030,8 +1030,16 @@ i_apply(E, Ctxt, Ren, Env, S) ->
visit_and_count_size(Opnd, S)
end,
S3, Opnds),
- N = apply_size(length(Es)),
- {update_c_apply(E, E1, Es), count_size(N, S4)}
+ Arity = length(Es),
+ E2 = case is_c_fname(E1) andalso length(Es) =/= fname_arity(E1) of
+ true ->
+ V = new_var(Env),
+ update_c_let(E, [V], E1, update_c_apply(E, V, Es));
+ false ->
+ update_c_apply(E, E1, Es)
+ end,
+ N = apply_size(Arity),
+ {E2, count_size(N, S4)}
end.
apply_size(A) ->