aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_validator.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-02-14 08:06:05 +0100
committerBjörn Gustavsson <[email protected]>2018-02-14 08:06:05 +0100
commit1ae9c8d415642029738bba0aa62c170a67de3a1f (patch)
treef9fbae1b410d317537d143d968a91624c8047524 /lib/compiler/src/beam_validator.erl
parent57b5a2bff8b69a1afb6f661a5be6718f0848c616 (diff)
parent17a20d8f16f638697c64b4154968215835868d31 (diff)
downloadotp-1ae9c8d415642029738bba0aa62c170a67de3a1f.tar.gz
otp-1ae9c8d415642029738bba0aa62c170a67de3a1f.tar.bz2
otp-1ae9c8d415642029738bba0aa62c170a67de3a1f.zip
Merge branch 'maint'
* maint: Check that the stack is initialized when an exception may occur
Diffstat (limited to 'lib/compiler/src/beam_validator.erl')
-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 7e5d86c177..9de773542e 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -1349,7 +1349,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