diff options
author | Björn Gustavsson <[email protected]> | 2019-03-11 12:41:15 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-03-11 12:41:15 +0100 |
commit | 0ffc8346553a5fc9322a75d4d8be5417dad67f29 (patch) | |
tree | 83eb45e1ed05c612fb30de2d3c78fa7835b1070b /lib/compiler/test | |
parent | 82e727974f15d3b4318b18bd59cb64d57e2e4f8a (diff) | |
parent | 32ae1b4404b200d4a033d34920e09854770be042 (diff) | |
download | otp-0ffc8346553a5fc9322a75d4d8be5417dad67f29.tar.gz otp-0ffc8346553a5fc9322a75d4d8be5417dad67f29.tar.bz2 otp-0ffc8346553a5fc9322a75d4d8be5417dad67f29.zip |
Merge branch 'john/compiler/float-opt-guard-fix'
* john/compiler/float-opt-guard-fix:
beam_ssa_opt: Fix crash in ssa_opt_float
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/float_SUITE.erl | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/compiler/test/float_SUITE.erl b/lib/compiler/test/float_SUITE.erl index 831e8279aa..0fa8070dc8 100644 --- a/lib/compiler/test/float_SUITE.erl +++ b/lib/compiler/test/float_SUITE.erl @@ -21,15 +21,16 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, pending/1,bif_calls/1,math_functions/1,mixed_float_and_int/1, - subtract_number_type/1]). + subtract_number_type/1,float_followed_by_guard/1]). -include_lib("common_test/include/ct.hrl"). suite() -> [{ct_hooks,[ts_install_cth]}]. -all() -> +all() -> [pending, bif_calls, math_functions, - mixed_float_and_int, subtract_number_type]. + mixed_float_and_int, subtract_number_type, + float_followed_by_guard]. groups() -> []. @@ -187,5 +188,21 @@ fact(0, P) -> P; fact(1, P) -> P; fact(N, P) -> fact(N-1, P*N). +float_followed_by_guard(Config) when is_list(Config) -> + true = ffbg_1(5, 1), + false = ffbg_1(1, 5), + ok. + +ffbg_1(A, B0) -> + %% This is a non-guard block followed by a *guard block* that starts with a + %% floating point operation, and the compiler erroneously assumed that it + %% was safe to skip fcheckerror because the next block started with a float + %% op. + B = id(B0) / 1.0, + if + A - B > 0.0 -> true; + A - B =< 0.0 -> false + end. + id(I) -> I. |