diff options
author | John Högberg <[email protected]> | 2019-07-04 14:44:47 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-07-04 14:44:47 +0200 |
commit | 1e939011dadacc699f249ca6392345351f5bcadc (patch) | |
tree | f7c885488492d94909715cc68981f006db19fb96 /lib/compiler/test | |
parent | 8fb06b5b98c0bdc959d82d7e19400047a9188d8d (diff) | |
parent | 3dd5ab9473f888ceb8f2ae6d71f51cd92de83f5b (diff) | |
download | otp-1e939011dadacc699f249ca6392345351f5bcadc.tar.gz otp-1e939011dadacc699f249ca6392345351f5bcadc.tar.bz2 otp-1e939011dadacc699f249ca6392345351f5bcadc.zip |
Merge branch 'john/compiler/fix-unsafe-tuple_size-opt/OTP-15945' into maint
* 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. |