aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-02-14 08:04:30 +0100
committerGitHub <[email protected]>2018-02-14 08:04:30 +0100
commit17a20d8f16f638697c64b4154968215835868d31 (patch)
tree4ce95e69c26a9cccb0923d44d049eadd283d89a6
parentdc0b345ae5374a422250c9d2e3bec63e6186afca (diff)
parent73ff9fa2126d96e5b30d01abd6c4560407f295e4 (diff)
downloadotp-17a20d8f16f638697c64b4154968215835868d31.tar.gz
otp-17a20d8f16f638697c64b4154968215835868d31.tar.bz2
otp-17a20d8f16f638697c64b4154968215835868d31.zip
Merge pull request #1712 from bjorng/bjorn/compiler/beam_validator
Check that the stack is initialized when an exception may occur
-rw-r--r--lib/compiler/src/beam_validator.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index 6219bc6894..ea38969814 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -1329,7 +1329,12 @@ branch_arities([Sz,{f,L}|T], Tuple, #vst{current=St}=Vst0)
Vst = branch_state(L, Vst1),
branch_arities(T, Tuple, Vst#vst{current=St}).
-branch_state(0, #vst{}=Vst) -> Vst;
+branch_state(0, #vst{}=Vst) ->
+ %% If the instruction fails, the stack may be scanned
+ %% looking for a catch tag. Therefore the Y registers
+ %% must be initialized at this point.
+ verify_y_init(Vst),
+ Vst;
branch_state(L, #vst{current=St,branched=B}=Vst) ->
Vst#vst{
branched=case gb_trees:is_defined(L, B) of