diff options
author | Björn Gustavsson <bjorn@erlang.org> | 2023-05-02 05:53:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 05:53:30 +0200 |
commit | eec8a2b6afc9b377ee22fac7a4341b71bfb57e09 (patch) | |
tree | 52243e9fe66c4501ef98d65b895aca02dd95450a | |
parent | 1ad3b56b227646761c690d5a1f3280149da7cf2b (diff) | |
parent | 16c2083c78a207f296918a831527e44b026c432d (diff) | |
download | erlang-eec8a2b6afc9b377ee22fac7a4341b71bfb57e09.tar.gz |
Merge pull request #7188 from bjorng/bjorn/compiler/fix-beam_jump/GH-7180
Eliminate unsafe sharing optimization in beam_jump
-rw-r--r-- | lib/compiler/src/beam_jump.erl | 1 | ||||
-rw-r--r-- | lib/compiler/test/beam_jump_SUITE.erl | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_jump.erl b/lib/compiler/src/beam_jump.erl index 90672bab7c..9ae5a33d74 100644 --- a/lib/compiler/src/beam_jump.erl +++ b/lib/compiler/src/beam_jump.erl @@ -464,6 +464,7 @@ add_scope([I|Is], Scope) -> [I|add_scope(Is, Scope)]; add_scope([], _Scope) -> []. +is_shareable([{badmatch,_}|_]) -> false; is_shareable([build_stacktrace|_]) -> false; is_shareable([{case_end,_}|_]) -> false; is_shareable([{'catch',_,_}|_]) -> false; diff --git a/lib/compiler/test/beam_jump_SUITE.erl b/lib/compiler/test/beam_jump_SUITE.erl index 713a1ea5ab..65fecd5b7c 100644 --- a/lib/compiler/test/beam_jump_SUITE.erl +++ b/lib/compiler/test/beam_jump_SUITE.erl @@ -82,6 +82,8 @@ ambiguous_catch_try_state(Config) -> {'EXIT',{{badmatch,0},_}} = (catch ambiguous_catch_try_state_2()), {'EXIT',{{badmatch,0},_}} = (catch ambiguous_catch_try_state_3()), + {'EXIT',{badarg,_}} = catch ambiguous_catch_try_state_4(), + ok. river() -> song. @@ -229,6 +231,12 @@ ambiguous_catch_try_state_3() -> end. +ambiguous_catch_try_state_4() -> + 0.0 = try binary_to_float(garbage_collect() orelse ((1.0 = tuple_to_list(ok)) -- ok)) + after + ok + end. + -record(message2, {id, p1}). -record(message3, {id, p1, p2}). |