aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2015-11-30 14:46:42 +0100
committerMagnus Lång <[email protected]>2015-11-30 15:06:46 +0100
commit21918b53a12107fdb1374387acd8b439515bd40d (patch)
treedc6bfac3361e870f4b5207f9060ffabda5545f38
parent720139f2d285a5746ba712efa236ad4938436e0f (diff)
downloadotp-21918b53a12107fdb1374387acd8b439515bd40d.tar.gz
otp-21918b53a12107fdb1374387acd8b439515bd40d.tar.bz2
otp-21918b53a12107fdb1374387acd8b439515bd40d.zip
hipe: Add tests for bad bit syntax float sizes
-rw-r--r--lib/hipe/test/bs_SUITE_data/bs_construct.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/hipe/test/bs_SUITE_data/bs_construct.erl b/lib/hipe/test/bs_SUITE_data/bs_construct.erl
index 7d59482662..7251cdce43 100644
--- a/lib/hipe/test/bs_SUITE_data/bs_construct.erl
+++ b/lib/hipe/test/bs_SUITE_data/bs_construct.erl
@@ -17,6 +17,7 @@ test() ->
ok = not_used(),
ok = bad_append(),
ok = system_limit(),
+ ok = bad_floats(),
ok.
%%--------------------------------------------------------------------
@@ -257,3 +258,14 @@ system_limit_32() ->
{'EXIT',{system_limit,_}} = (catch <<0:(1 bsl 43)>>),
{'EXIT',{system_limit,_}} = (catch <<0:((1 bsl 40)+1)>>),
ok.
+
+%%--------------------------------------------------------------------
+
+bad_floats() ->
+ WordSize = erlang:system_info(wordsize),
+ BitsPerWord = WordSize * 8,
+ {'EXIT',{badarg,_}} = (catch <<3.14:(id(33))/float>>),
+ {'EXIT',{badarg,_}} = (catch <<3.14:(id(64 bor 32))/float>>),
+ {'EXIT',{badarg,_}} = (catch <<3.14:(id((1 bsl 28) bor 32))/float>>),
+ {'EXIT',{system_limit,_}} = (catch <<3.14:(id(1 bsl BitsPerWord))/float>>),
+ ok.