diff options
author | Björn Gustavsson <[email protected]> | 2019-01-07 15:53:52 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-01-07 15:53:52 +0100 |
commit | 50615884e34c99a22ae6efa0c389506eeb607fa6 (patch) | |
tree | 15e0222e3230a618a854bbfb089de34c2a86b164 | |
parent | 753a9e62bd100c9a81f484a5af3512888f9e093d (diff) | |
parent | 5a382cf1342f102a49bbf6faf11a9f90bdd7a7b7 (diff) | |
download | otp-50615884e34c99a22ae6efa0c389506eeb607fa6.tar.gz otp-50615884e34c99a22ae6efa0c389506eeb607fa6.tar.bz2 otp-50615884e34c99a22ae6efa0c389506eeb607fa6.zip |
Merge branch 'maint'
* maint:
Remove unsafe optimization for delaying creation of stackframe
Conflicts:
lib/compiler/src/v3_codegen.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 8393dced06..78276982eb 100644 --- a/lib/compiler/test/match_SUITE.erl +++ b/lib/compiler/test/match_SUITE.erl @@ -390,6 +390,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) -> @@ -402,6 +409,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]), |