diff options
author | Kostis Sagonas <[email protected]> | 2016-02-29 20:23:05 +0100 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2016-02-29 20:23:05 +0100 |
commit | c3af7910226cabddcdfa1561b56127e71e3a2ee9 (patch) | |
tree | ac39fad211f8882d2169cf663e30fbdb0a31800a | |
parent | 97ff595e4e0303f597e671b17045940ba8da0330 (diff) | |
download | otp-c3af7910226cabddcdfa1561b56127e71e3a2ee9.tar.gz otp-c3af7910226cabddcdfa1561b56127e71e3a2ee9.tar.bz2 otp-c3af7910226cabddcdfa1561b56127e71e3a2ee9.zip |
A test that crashes the HiPE compiler when inlining FP ops
-rw-r--r-- | lib/hipe/test/basic_SUITE_data/basic_floats.erl | 30 |
1 files changed, 30 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 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. |