aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-05-20 15:18:53 +0200
committerBjörn Gustavsson <[email protected]>2016-05-23 08:39:52 +0200
commit69bb7b21a552c6e7d0615d4ead0345370deec2a0 (patch)
tree7ee9634a3e4e22fd3b156b0bf0999af2ffc033c0 /lib/compiler/src
parent9ab0dcce5a2bf609917cb09c36cbf63dad6bb679 (diff)
downloadotp-69bb7b21a552c6e7d0615d4ead0345370deec2a0.tar.gz
otp-69bb7b21a552c6e7d0615d4ead0345370deec2a0.tar.bz2
otp-69bb7b21a552c6e7d0615d4ead0345370deec2a0.zip
beam_bool: Reject potentially unsafe optimization
When calculating the sets of registers that must be killed or unused, registers set in a {protected,_,_,_} block were not considered. That could result in a crash in the assertion in beam_utils:live_opt_block/4.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_bool.erl2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_bool.erl b/lib/compiler/src/beam_bool.erl
index 359fdb6d3c..99e4ccb1e9 100644
--- a/lib/compiler/src/beam_bool.erl
+++ b/lib/compiler/src/beam_bool.erl
@@ -311,6 +311,8 @@ dst_regs([{set,[D],_,{bif,_,{f,_}}}|Is], Acc) ->
dst_regs(Is, [D|Acc]);
dst_regs([{set,[D],_,{alloc,_,{gc_bif,_,{f,_}}}}|Is], Acc) ->
dst_regs(Is, [D|Acc]);
+dst_regs([{protected,_,Bl,_}|Is], Acc) ->
+ dst_regs(Bl, dst_regs(Is, Acc));
dst_regs([_|Is], Acc) ->
dst_regs(Is, Acc);
dst_regs([], Acc) -> ordsets:from_list(Acc).