From 45314b86cf1923dd707fe14bd431c919607bb0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 28 Apr 2010 07:16:02 +0200 Subject: 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. --- lib/compiler/src/beam_bool.erl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/compiler/src/beam_bool.erl') 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)); -- cgit v1.2.3