diff options
author | Erlang/OTP <[email protected]> | 2019-07-09 09:52:14 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2019-07-09 09:52:14 +0200 |
commit | 82bfcda20f6ca3ec77bc3f35974aca82c12b896f (patch) | |
tree | 7e94f5139b29448138e3d0e91dc5f422a4a3de3b /lib/compiler/test | |
parent | 595cc2fe5efeac924f866aa68263cb3cd65b9910 (diff) | |
parent | 3dd5ab9473f888ceb8f2ae6d71f51cd92de83f5b (diff) | |
download | otp-82bfcda20f6ca3ec77bc3f35974aca82c12b896f.tar.gz otp-82bfcda20f6ca3ec77bc3f35974aca82c12b896f.tar.bz2 otp-82bfcda20f6ca3ec77bc3f35974aca82c12b896f.zip |
Merge branch 'john/compiler/fix-unsafe-tuple_size-opt/OTP-15945' into maint-22
* john/compiler/fix-unsafe-tuple_size-opt/OTP-15945:
beam_ssa_opt: Do not apply tuple_size optimization outside guards
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/match_SUITE.erl | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/compiler/test/match_SUITE.erl b/lib/compiler/test/match_SUITE.erl index aac9de278d..bc74ec4984 100644 --- a/lib/compiler/test/match_SUITE.erl +++ b/lib/compiler/test/match_SUITE.erl @@ -25,7 +25,8 @@ match_in_call/1,untuplify/1,shortcut_boolean/1,letify_guard/1, selectify/1,deselectify/1,underscore/1,match_map/1,map_vars_used/1, coverage/1,grab_bag/1,literal_binary/1, - unary_op/1,eq_types/1,match_after_return/1,match_right_tuple/1]). + unary_op/1,eq_types/1,match_after_return/1,match_right_tuple/1, + tuple_size_in_try/1]). -include_lib("common_test/include/ct.hrl"). @@ -41,7 +42,8 @@ groups() -> shortcut_boolean,letify_guard,selectify,deselectify, underscore,match_map,map_vars_used,coverage, grab_bag,literal_binary,unary_op,eq_types, - match_after_return,match_right_tuple]}]. + match_after_return,match_right_tuple, + tuple_size_in_try]}]. init_per_suite(Config) -> @@ -922,4 +924,19 @@ match_right_tuple_1(T) -> force_succ_regs(_A, B) -> B. +tuple_size_in_try(Config) when is_list(Config) -> + %% The tuple_size optimization was applied outside of guards, causing + %% either the emulator or compiler to crash. + ok = tsit(gurka), + ok = tsit(gaffel). + +tsit(A) -> + try + id(ignored), + 1 = tuple_size(A), + error + catch + _:_ -> ok + end. + id(I) -> I. |