diff options
author | Erlang/OTP <[email protected]> | 2019-07-09 09:52:15 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2019-07-09 09:52:15 +0200 |
commit | 861aaf5ae85c9992329b0dbb726c46696ee22fff (patch) | |
tree | 0f1fea08c4970000c50a6979c8cebd2912c69c70 /lib/compiler/test | |
parent | 82bfcda20f6ca3ec77bc3f35974aca82c12b896f (diff) | |
parent | a8461ffed773c4ff80779c16a3637ba3d2e915fd (diff) | |
download | otp-861aaf5ae85c9992329b0dbb726c46696ee22fff.tar.gz otp-861aaf5ae85c9992329b0dbb726c46696ee22fff.tar.bz2 otp-861aaf5ae85c9992329b0dbb726c46696ee22fff.zip |
Merge branch 'john/compiler/fix-fail-path-exceptions-bsm/OTP-15946' into maint-22
* john/compiler/fix-fail-path-exceptions-bsm/OTP-15946:
beam_ssa_bsm: Leave ?BADARG_BLOCK alone when cloning fail path
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/bs_match_SUITE.erl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl index d97f49c56e..145a50f4ad 100644 --- a/lib/compiler/test/bs_match_SUITE.erl +++ b/lib/compiler/test/bs_match_SUITE.erl @@ -44,7 +44,8 @@ beam_bsm/1,guard/1,is_ascii/1,non_opt_eq/1, expression_before_match/1,erl_689/1,restore_on_call/1, restore_after_catch/1,matches_on_parameter/1,big_positions/1, - matching_meets_apply/1,bs_start_match2_defs/1]). + matching_meets_apply/1,bs_start_match2_defs/1, + exceptions_after_match_failure/1]). -export([coverage_id/1,coverage_external_ignore/2]). @@ -80,7 +81,8 @@ groups() -> beam_bsm,guard,is_ascii,non_opt_eq, expression_before_match,erl_689,restore_on_call, matches_on_parameter,big_positions, - matching_meets_apply,bs_start_match2_defs]}]. + matching_meets_apply,bs_start_match2_defs, + exceptions_after_match_failure]}]. init_per_suite(Config) -> @@ -2005,4 +2007,17 @@ do_matching_meets_apply(_Bin, {Handler, State}) -> %% Another case of the above. Handler:abs(State). +%% Exception handling was broken on the failure path of bs_start_match as +%% beam_ssa_bsm accidentally cloned and renamed the ?BADARG_BLOCK. +exceptions_after_match_failure(_Config) -> + {'EXIT', {badarith, _}} = (catch do_exceptions_after_match_failure(atom)), + ok = do_exceptions_after_match_failure(<<0, 1, "gurka">>), + ok = do_exceptions_after_match_failure(2.0). + +do_exceptions_after_match_failure(<<_A, _B, "gurka">>) -> + ok; +do_exceptions_after_match_failure(Other) -> + Other / 2.0, + ok. + id(I) -> I. |