aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/test/basic_SUITE_data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hipe/test/basic_SUITE_data')
-rw-r--r--lib/hipe/test/basic_SUITE_data/basic_floats.erl41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/hipe/test/basic_SUITE_data/basic_floats.erl b/lib/hipe/test/basic_SUITE_data/basic_floats.erl
index 32bbb6c7fc..ebd3852002 100644
--- a/lib/hipe/test/basic_SUITE_data/basic_floats.erl
+++ b/lib/hipe/test/basic_SUITE_data/basic_floats.erl
@@ -19,6 +19,7 @@ test() ->
ok = test_fp_with_fp_exceptions(),
%% ok = test_fmt_double_fpe_leak(), % this requires printing
ok = test_icode_type_crash(),
+ ok = test_icode_type_crash_2(),
ok.
%%--------------------------------------------------------------------
@@ -208,3 +209,43 @@ f(A, B, C) ->
end,
Y * Z
end.
+
+%%%-------------------------------------------------------------------
+%%% Contains another case that crashes hipe_icode_fp. This sample was
+%%% sent by Mattias Jansson. Compiles alright with the option
+%%% 'no_icode_type' but that defeats the purpose of the test.
+
+test_icode_type_crash_2() ->
+ {'EXIT', {function_clause, _}} = (catch eat()),
+ ok.
+
+eat() ->
+ eat_what(1.0, #{}).
+
+eat_what(Factor, #{rat_type := LT} = Rat) ->
+ #{ cheese := Cheese } = Rat,
+ UnitCheese = Cheese / 2,
+ RetA = case eat() of
+ {full, RetA1} ->
+ CheeseB2 = min(RetA1, UnitCheese) * Factor,
+ case eat() of
+ full ->
+ {win, RetA1};
+ hungry ->
+ {partial, RetA1 - CheeseB2}
+ end;
+ AOther ->
+ AOther
+ end,
+ RetB = case eat() of
+ {full, RetB1} ->
+ CheeseA2 = min(RetB1, UnitCheese) * Factor,
+ rat:init(single, LT, CheeseA2),
+ case eat() of
+ full ->
+ {full, RetB1};
+ hungry ->
+ {hungry, RetB1 - CheeseA2}
+ end
+ end,
+ {RetA, RetB}.