diff options
author | Björn Gustavsson <[email protected]> | 2013-08-14 13:16:00 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-08-15 12:21:06 +0200 |
commit | 8e10c8aac09de9165deb1c04cd908c8057c7f173 (patch) | |
tree | 9c9d5af889e78221bd422859461ab4e95c59b21f /lib | |
parent | fd3e32e7a13b522a04e17c815bba11d307fa1049 (diff) | |
download | otp-8e10c8aac09de9165deb1c04cd908c8057c7f173.tar.gz otp-8e10c8aac09de9165deb1c04cd908c8057c7f173.tar.bz2 otp-8e10c8aac09de9165deb1c04cd908c8057c7f173.zip |
Fix compiler crash for 'B and B' guard
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/src/beam_bool.erl | 3 | ||||
-rw-r--r-- | lib/compiler/test/guard_SUITE.erl | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_bool.erl b/lib/compiler/src/beam_bool.erl index cf5455dfde..124abd13c1 100644 --- a/lib/compiler/src/beam_bool.erl +++ b/lib/compiler/src/beam_bool.erl @@ -425,6 +425,9 @@ bopt_tree([], Forest, Pre) -> safe_bool_op(N, Ar) -> erl_internal:new_type_test(N, Ar) orelse erl_internal:comp_op(N, Ar). +bopt_bool_args([V0,V0], Forest0) -> + {V,Forest} = bopt_bool_arg(V0, Forest0), + {[V,V],Forest}; bopt_bool_args(As, Forest) -> mapfoldl(fun bopt_bool_arg/2, Forest, As). diff --git a/lib/compiler/test/guard_SUITE.erl b/lib/compiler/test/guard_SUITE.erl index 5656d23090..a0a9bb7ddd 100644 --- a/lib/compiler/test/guard_SUITE.erl +++ b/lib/compiler/test/guard_SUITE.erl @@ -813,8 +813,16 @@ and_guard(Config) when is_list(Config) -> ?line ok = relprod({'Set',a,b}, {'Set',a,b}), + ok = and_same_var(42), + {'EXIT',{if_clause,_}} = (catch and_same_var(x)), ok. +and_same_var(V) -> + B = is_integer(V), + if + B or B -> ok + end. + relprod(R1, R2) when (erlang:size(R1) =:= 3) and (erlang:element(1,R1) =:= 'Set'), (erlang:size(R2) =:= 3) and (erlang:element(1,R2) =:= 'Set') -> ok. |