aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2014-03-04 02:08:06 +0100
committerAnthony Ramine <[email protected]>2014-03-04 02:08:06 +0100
commitd5fc107d5ae384bfb7b7ea1a10291b75d821c666 (patch)
treed828cfb90dec8bfcb63dddd88a1c510d0b9f3954 /lib/compiler/test
parenta74e66a68f3b4ed590f928b4fd4f0808c6287a32 (diff)
downloadotp-d5fc107d5ae384bfb7b7ea1a10291b75d821c666.tar.gz
otp-d5fc107d5ae384bfb7b7ea1a10291b75d821c666.tar.bz2
otp-d5fc107d5ae384bfb7b7ea1a10291b75d821c666.zip
Properly detect nonboolean protected expressions in beam_bool
Silly code such as the following could make the compiler crash: f() when erlang:float(self()); true -> ok. Reported-by: Ulf Norell
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/guard_SUITE.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/compiler/test/guard_SUITE.erl b/lib/compiler/test/guard_SUITE.erl
index a0a9bb7ddd..3350d18bcc 100644
--- a/lib/compiler/test/guard_SUITE.erl
+++ b/lib/compiler/test/guard_SUITE.erl
@@ -33,7 +33,7 @@
tricky/1,rel_ops/1,literal_type_tests/1,
basic_andalso_orelse/1,traverse_dcd/1,
check_qlc_hrl/1,andalso_semi/1,t_tuple_size/1,binary_part/1,
- bad_constants/1]).
+ bad_constants/1,bad_guards/1]).
suite() -> [{ct_hooks,[ts_install_cth]}].
@@ -50,7 +50,7 @@ groups() ->
t_is_boolean,is_function_2,tricky,rel_ops,
literal_type_tests,basic_andalso_orelse,traverse_dcd,
check_qlc_hrl,andalso_semi,t_tuple_size,binary_part,
- bad_constants]}].
+ bad_constants,bad_guards]}].
init_per_suite(Config) ->
Config.
@@ -1550,6 +1550,10 @@ bad_constants(Config) when is_list(Config) ->
?line ?FAILING(3.14),
ok.
+bad_guards(Config) when is_list(Config) ->
+ if erlang:float(self()); true -> ok end,
+ ok.
+
%% Call this function to turn off constant propagation.
id(I) -> I.