aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/beam_jump_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-08-12 12:03:39 +0200
committerBjörn Gustavsson <[email protected]>2016-08-12 12:03:39 +0200
commitce260c34b555e9e2d74fe9491e9e3a20cfcd6c82 (patch)
treea4bcc014cccca493a31f4e3df0ea43f323693091 /lib/compiler/test/beam_jump_SUITE.erl
parent7613ee0580b0536ad868e1314c70399cf5b264f3 (diff)
parentd39cac954fc76a838763ac1ac03cb71bf8e5d68d (diff)
downloadotp-ce260c34b555e9e2d74fe9491e9e3a20cfcd6c82.tar.gz
otp-ce260c34b555e9e2d74fe9491e9e3a20cfcd6c82.tar.bz2
otp-ce260c34b555e9e2d74fe9491e9e3a20cfcd6c82.zip
Merge branch 'bjorn/compiler/ambiguous_catch_try_state/ERL-209/OTP-13804' into maint
* bjorn/compiler/ambiguous_catch_try_state/ERL-209/OTP-13804: [ERL-209] Fix ambiguous_catch_try_state inconsistency error
Diffstat (limited to 'lib/compiler/test/beam_jump_SUITE.erl')
-rw-r--r--lib/compiler/test/beam_jump_SUITE.erl19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/compiler/test/beam_jump_SUITE.erl b/lib/compiler/test/beam_jump_SUITE.erl
index 0b13adaff2..088f63606c 100644
--- a/lib/compiler/test/beam_jump_SUITE.erl
+++ b/lib/compiler/test/beam_jump_SUITE.erl
@@ -21,7 +21,7 @@
-export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1,
init_per_group/2,end_per_group/2,
- undefined_label/1]).
+ undefined_label/1,ambiguous_catch_try_state/1]).
suite() ->
[{ct_hooks,[ts_install_cth]}].
@@ -32,7 +32,8 @@ all() ->
groups() ->
[{p,[parallel],
- [undefined_label
+ [undefined_label,
+ ambiguous_catch_try_state
]}].
init_per_suite(Config) ->
@@ -57,3 +58,17 @@ flights(0, [], []) when [], 0; 0.0, [], false ->
clark;
flights(_, Reproduction, introduction) when false, Reproduction ->
responsible.
+
+%% [ERL-209] beam_jump would share 'catch' blocks, causing an
+%% ambiguous_catch_try_state error in beam_validator.
+
+ambiguous_catch_try_state(_Config) ->
+ {{'EXIT',{{case_clause,song},_}},{'EXIT',{{case_clause,song},_}}} =
+ checks(42),
+ ok.
+
+river() -> song.
+
+checks(Wanted) ->
+ %% Must be one line to cause the unsafe optimization.
+ {catch case river() of sheet -> begin +Wanted, if "da" -> Wanted end end end, catch case river() of sheet -> begin + Wanted, if "da" -> Wanted end end end}.