diff options
author | Björn Gustavsson <[email protected]> | 2019-01-07 15:52:38 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-01-07 15:52:38 +0100 |
commit | 5a382cf1342f102a49bbf6faf11a9f90bdd7a7b7 (patch) | |
tree | 3d029326964dda3b097fa50605388c35d2079314 /lib/compiler/test/match_SUITE.erl | |
parent | 22636c38163e0a5ceb4feb71f72c62679a590a78 (diff) | |
parent | 7a01269e62f21ac3ba9858dd358716081549bea3 (diff) | |
download | otp-5a382cf1342f102a49bbf6faf11a9f90bdd7a7b7.tar.gz otp-5a382cf1342f102a49bbf6faf11a9f90bdd7a7b7.tar.bz2 otp-5a382cf1342f102a49bbf6faf11a9f90bdd7a7b7.zip |
Merge branch 'bjorn/compiler/interim-tuple-bug/OTP-15501/ERL-807' into maint
* bjorn/compiler/interim-tuple-bug/OTP-15501/ERL-807:
Remove unsafe optimization for delaying creation of stackframe
Diffstat (limited to 'lib/compiler/test/match_SUITE.erl')
-rw-r--r-- | lib/compiler/test/match_SUITE.erl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/compiler/test/match_SUITE.erl b/lib/compiler/test/match_SUITE.erl index e3f842b668..72e5356a8d 100644 --- a/lib/compiler/test/match_SUITE.erl +++ b/lib/compiler/test/match_SUITE.erl @@ -378,6 +378,13 @@ untuplify(Config) when is_list(Config) -> %% We do this to cover sys_core_fold:unalias_pat/1. {1,2,3,4,alias,{[1,2],{3,4},alias}} = untuplify_1([1,2], {3,4}, alias), error = untuplify_1([1,2], {3,4}, 42), + + %% Test that a previous bug in v3_codegen is gone. (The sinking of + %% stack frames into only the case arms that needed them was not always + %% safe.) + [33, -1, -33, 1] = untuplify_2(32, 65), + {33, 1, -33, -1} = untuplify_2(65, 32), + ok. untuplify_1(A, B, C) -> @@ -390,6 +397,21 @@ untuplify_1(A, B, C) -> error end. +untuplify_2(V1, V2) -> + {D1,D2,D3,D4} = + if V1 > V2 -> + %% The 1 value was overwritten by the value of V2-V1. + {V1-V2, 1, V2-V1, -1}; + true -> + {V2-V1, -1, V1-V2, 1} + end, + if + D2 > D4 -> + {D1, D2, D3, D4}; + true -> + [D1, D2, D3, D4] + end. + %% Coverage of beam_dead:shortcut_boolean_label/4. shortcut_boolean(Config) when is_list(Config) -> false = shortcut_boolean_1([0]), |