diff options
author | Erlang/OTP <[email protected]> | 2019-07-09 09:52:13 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2019-07-09 09:52:13 +0200 |
commit | e15b0d1f07f02251176e203ad6da2624e8505c66 (patch) | |
tree | 0672c9687fa1d3ec7894b415365bb7afda560e72 /lib/compiler/test | |
parent | 7999631c63998cffc07bbcc91dd86cbe709dde5f (diff) | |
parent | e20015186fa2372793650a98005faf88e6f6e0fa (diff) | |
download | otp-e15b0d1f07f02251176e203ad6da2624e8505c66.tar.gz otp-e15b0d1f07f02251176e203ad6da2624e8505c66.tar.bz2 otp-e15b0d1f07f02251176e203ad6da2624e8505c66.zip |
Merge branch 'john/compiler/fix-try_catch-receives/OTP-15952' into maint-22
* john/compiler/fix-try_catch-receives/OTP-15952:
compiler: Fix broken 'receive' in try/catch blocks
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/beam_ssa_SUITE.erl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/compiler/test/beam_ssa_SUITE.erl b/lib/compiler/test/beam_ssa_SUITE.erl index a741ebbdf9..256bb95559 100644 --- a/lib/compiler/test/beam_ssa_SUITE.erl +++ b/lib/compiler/test/beam_ssa_SUITE.erl @@ -190,6 +190,12 @@ recv(_Config) -> self() ! {[self(),r1],{2,99,<<"data">>}}, {Parent,r1,<<1:32,2:8,99:8,"data">>} = tricky_recv_4(), + %% Test tricky_recv_5/0. + self() ! 1, + a = tricky_recv_5(), + self() ! 2, + b = tricky_recv_5(), + ok. sync_wait_mon({Pid, Ref}, Timeout) -> @@ -295,6 +301,26 @@ tricky_recv_4() -> end, id({Pid,R,Request}). +%% beam_ssa_pre_codegen would accidentally create phi nodes on critical edges +%% when fixing up receives; the call to id/2 can either succeed or land in the +%% catch block, and we added a phi node to its immediate successor. +tricky_recv_5() -> + try + receive + X=1 -> + id(42), + a; + X=2 -> + b + end, + case X of + 1 -> a; + 2 -> b + end + catch + _:_ -> c + end. + maps(_Config) -> {'EXIT',{{badmatch,#{}},_}} = (catch maps_1(any)), ok. |