aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/andor_SUITE.erl
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2014-03-01 17:26:56 +0100
committerAnthony Ramine <[email protected]>2014-03-05 10:18:15 +0100
commit926be4d0a3a75f48bc280a7aa2f97fc4adbef189 (patch)
treece0074eeaffcfd38187cb9609471deb4242a0b44 /lib/compiler/test/andor_SUITE.erl
parentc199bd2923e7d733e60beb9bd27b3852cbb2e699 (diff)
downloadotp-926be4d0a3a75f48bc280a7aa2f97fc4adbef189.tar.gz
otp-926be4d0a3a75f48bc280a7aa2f97fc4adbef189.tar.bz2
otp-926be4d0a3a75f48bc280a7aa2f97fc4adbef189.zip
Do not try to optimize non-boolean guards
Expressions such as erlang:'or'(bar, true) can make beam_bool crash if it tries to optimize them, as this code is not quite really written by users, no attempt to rewrite them more efficiently should be done, for simplicity's sake. Reported-by: Ulf Norell
Diffstat (limited to 'lib/compiler/test/andor_SUITE.erl')
-rw-r--r--lib/compiler/test/andor_SUITE.erl15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/compiler/test/andor_SUITE.erl b/lib/compiler/test/andor_SUITE.erl
index 7bef0aa27c..d79696df38 100644
--- a/lib/compiler/test/andor_SUITE.erl
+++ b/lib/compiler/test/andor_SUITE.erl
@@ -129,6 +129,10 @@ t_case_y(X, Y, Z) ->
Y =:= 100
end.
+-define(GUARD(E), if E -> true;
+ true -> false
+ end).
+
t_and_or(Config) when is_list(Config) ->
?line true = true and true,
?line false = true and false,
@@ -160,11 +164,14 @@ t_and_or(Config) when is_list(Config) ->
?line true = false or id(true),
?line false = false or id(false),
- ok.
+ True = id(true),
--define(GUARD(E), if E -> true;
- true -> false
- end).
+ false = ?GUARD(erlang:'and'(bar, True)),
+ false = ?GUARD(erlang:'or'(bar, True)),
+ false = ?GUARD(erlang:'not'(erlang:'and'(bar, True))),
+ false = ?GUARD(erlang:'not'(erlang:'not'(erlang:'and'(bar, True)))),
+
+ ok.
t_andalso(Config) when is_list(Config) ->
Bs = [true,false],