aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-04-28 07:16:02 +0200
committerRaimo Niskanen <[email protected]>2010-05-20 12:20:49 +0200
commit45314b86cf1923dd707fe14bd431c919607bb0a9 (patch)
tree2f0474f497557a8d4ab6ad6a5a116b27ac1e80af
parent0078862df75ff97827a09aee8e59fe3cf9343a5e (diff)
downloadotp-45314b86cf1923dd707fe14bd431c919607bb0a9.tar.gz
otp-45314b86cf1923dd707fe14bd431c919607bb0a9.tar.bz2
otp-45314b86cf1923dd707fe14bd431c919607bb0a9.zip
beam_bool: Remove a clause in initialized_regs/2 that cannot match
When scanning a reversed instruction sequence for a function, it is impossible to reach the end of the list, because each function must have a fun_info/4 instruction followed by a label/1 instruction at the beginning, and there is a clause that will handle those instructions. If for some unfathomable reason the end of the list would be reached, with this change there will be an internal compiler error and no *.beam file will be created. Thus this change is safe.
-rw-r--r--lib/compiler/src/beam_bool.erl3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_bool.erl b/lib/compiler/src/beam_bool.erl
index dcc6ad4c7c..3ea0a470a5 100644
--- a/lib/compiler/src/beam_bool.erl
+++ b/lib/compiler/src/beam_bool.erl
@@ -748,8 +748,7 @@ initialized_regs([{bs_context_to_binary,Src}|Is], Regs) ->
initialized_regs([{label,_},{func_info,_,_,Arity}|_], Regs) ->
InitRegs = free_vars_regs(Arity),
add_init_regs(InitRegs, Regs);
-initialized_regs([_|_], Regs) -> Regs;
-initialized_regs([], Regs) -> Regs.
+initialized_regs([_|_], Regs) -> Regs.
add_init_regs([{x,_}=X|T], Regs) ->
add_init_regs(T, ordsets:add_element(X, Regs));