From c3af7910226cabddcdfa1561b56127e71e3a2ee9 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Mon, 29 Feb 2016 20:23:05 +0100 Subject: A test that crashes the HiPE compiler when inlining FP ops --- lib/hipe/test/basic_SUITE_data/basic_floats.erl | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'lib/hipe') diff --git a/lib/hipe/test/basic_SUITE_data/basic_floats.erl b/lib/hipe/test/basic_SUITE_data/basic_floats.erl index eec175075a..32bbb6c7fc 100644 --- a/lib/hipe/test/basic_SUITE_data/basic_floats.erl +++ b/lib/hipe/test/basic_SUITE_data/basic_floats.erl @@ -18,6 +18,7 @@ test() -> ok = test_catch_fp_conv(), ok = test_fp_with_fp_exceptions(), %% ok = test_fmt_double_fpe_leak(), % this requires printing + ok = test_icode_type_crash(), ok. %%-------------------------------------------------------------------- @@ -178,3 +179,32 @@ test_fmt_double_fpe_leak(X, Y) -> math:log10(Y). int_two() -> 2. + +%%-------------------------------------------------------------------- +%% Contains code which confuses the icode_type analysis and results +%% in a compiler crash. Stipped down from code sent by Paul Guyot. +%% Compiles alright with the option 'no_icode_type' but that defeats +%% the purpose of the test. + +test_icode_type_crash() -> + Fun = f(1, 2, 3), + 42.0 = Fun(), + ok. + +f(A, B, C) -> + fun () -> + X = case A of + 0 -> 1 / B; + _ -> A / C + end, + Y = case B of + a -> 1.0; + b -> 2.0; + _ -> 6.0 + end, + Z = case C of + c -> 0.1 * X; + _ -> 7.0 + end, + Y * Z + end. -- cgit v1.2.3