aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-03-05 12:53:39 +0100
committerBjörn Gustavsson <[email protected]>2014-03-05 12:53:39 +0100
commit17b1f6083bdde11909bb26bd24f6364b34d9694a (patch)
treeae35e4c2d76098585373e24e6995151707b581a0 /lib/compiler/src
parentf4346705566f668b5cf88b91c5c79cec215a6ad6 (diff)
parentd5fc107d5ae384bfb7b7ea1a10291b75d821c666 (diff)
downloadotp-17b1f6083bdde11909bb26bd24f6364b34d9694a.tar.gz
otp-17b1f6083bdde11909bb26bd24f6364b34d9694a.tar.bz2
otp-17b1f6083bdde11909bb26bd24f6364b34d9694a.zip
Merge branch 'nox/compiler/beam_bool-bad-protected'
* nox/compiler/beam_bool-bad-protected: Properly detect nonboolean protected expressions in beam_bool
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_bool.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/compiler/src/beam_bool.erl b/lib/compiler/src/beam_bool.erl
index 590665514b..81b6d78864 100644
--- a/lib/compiler/src/beam_bool.erl
+++ b/lib/compiler/src/beam_bool.erl
@@ -393,10 +393,14 @@ bopt_tree([{set,_,_,{bif,'xor',_}}|_], _, _) ->
throw('xor');
bopt_tree([{protected,[Dst],Code,_}|Is], Forest0, Pre) ->
ProtForest0 = gb_trees:from_orddict([P || {_,any}=P <- gb_trees:to_list(Forest0)]),
- {ProtPre,[{_,ProtTree}]} = bopt_tree(Code, ProtForest0, []),
- Prot = {prot,ProtPre,ProtTree},
- Forest = gb_trees:enter(Dst, Prot, Forest0),
- bopt_tree(Is, Forest, Pre);
+ case bopt_tree(Code, ProtForest0, []) of
+ {ProtPre,[{_,ProtTree}]} ->
+ Prot = {prot,ProtPre,ProtTree},
+ Forest = gb_trees:enter(Dst, Prot, Forest0),
+ bopt_tree(Is, Forest, Pre);
+ _Res ->
+ throw(not_boolean_expr)
+ end;
bopt_tree([{set,[Dst],[Src],move}=Move|Is], Forest, Pre) ->
case {Src,Dst} of
{{tmp,_},_} -> throw(move);