aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-01-29 07:31:51 +0100
committerBjörn Gustavsson <[email protected]>2019-01-29 07:31:51 +0100
commit2b603d86dbc8715eda4efc78294ded0770d2149e (patch)
treed60b522f573bed55d29142ce7bdb84eea55c7331
parent6af940b1c151f163f578ec74efa96f8002c0d820 (diff)
parentda72cd451dc29757c7297cba4ee3939f6d6cb1c1 (diff)
downloadotp-2b603d86dbc8715eda4efc78294ded0770d2149e.tar.gz
otp-2b603d86dbc8715eda4efc78294ded0770d2149e.tar.bz2
otp-2b603d86dbc8715eda4efc78294ded0770d2149e.zip
Merge branch 'bjorn/compiler/beam_except'
* bjorn/compiler/beam_except: beam_except: Eliminate unsafe function_clause translation
-rw-r--r--lib/compiler/src/beam_except.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/compiler/src/beam_except.erl b/lib/compiler/src/beam_except.erl
index 49bfb5606f..26b193a35b 100644
--- a/lib/compiler/src/beam_except.erl
+++ b/lib/compiler/src/beam_except.erl
@@ -79,13 +79,15 @@ translate_1(Ar, I, Is, #st{arity=Arity}=St, [{line,_}=Line|Acc1]=Acc0) ->
no ->
translate(Is, St, [I|Acc0]);
{yes,function_clause,Acc2} ->
- case {Line,St} of
- {{line,Loc},#st{lbl=Fi,loc=Loc}} ->
+ case {Is,Line,St} of
+ {[return|_],{line,Loc},#st{lbl=Fi,loc=Loc}} ->
Instr = {jump,{f,Fi}},
translate(Is, St, [Instr|Acc2]);
- {_,_} ->
- %% This must be "error(function_clause, Args)" in
- %% the Erlang source code or a fun. Don't translate.
+ {_,_,_} ->
+ %% Not a call_only instruction, or not the same
+ %% location information as in in the line instruction
+ %% before the func_info instruction. Not safe
+ %% to translate to a jump.
translate(Is, St, [I|Acc0])
end;
{yes,Instr,Acc2} ->