diff options
Diffstat (limited to 'lib/compiler/test/beam_except_SUITE.erl')
-rw-r--r-- | lib/compiler/test/beam_except_SUITE.erl | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/compiler/test/beam_except_SUITE.erl b/lib/compiler/test/beam_except_SUITE.erl index 9a90c1b676..f6aa666990 100644 --- a/lib/compiler/test/beam_except_SUITE.erl +++ b/lib/compiler/test/beam_except_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011-2022. All Rights Reserved. +%% Copyright Ericsson AB 2011-2023. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, multiple_allocs/1,bs_get_tail/1,coverage/1, - binary_construction_allocation/1]). + binary_construction_allocation/1,unfold_literals/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. @@ -34,7 +34,8 @@ groups() -> [multiple_allocs, bs_get_tail, coverage, - binary_construction_allocation]}]. + binary_construction_allocation, + unfold_literals]}]. init_per_suite(Config) -> test_lib:recompile(?MODULE), @@ -177,6 +178,19 @@ do_binary_construction_allocation(Req) -> _ -> ok end. +unfold_literals(_Config) -> + a = do_unfold_literals(badarg, id({a,b})), + {'EXIT',{badarg,_}} = catch do_unfold_literals(badarg, id(a)), + + ok. + +do_unfold_literals(_BadArg, T) -> + %% The call `erlang:error(badarg)` in ?EXCEPTION_BLOCK would be + %% rewritten to `erlang:error(_BadArg)` by + %% beam_ssa_opt:unfold_literals/1, which would cause + %% beam_ssa_codegen:assert_exception_block/1 to fail. + element(1, T). + id(I) -> I. -file("fake.erl", 1). |