diff options
| author | John Högberg <[email protected]> | 2019-07-09 09:41:49 +0200 |
|---|---|---|
| committer | John Högberg <[email protected]> | 2019-07-09 09:41:49 +0200 |
| commit | bb4955e083e34be40a9e0d5c0831e5b1498d11df (patch) | |
| tree | d246a53dfa62f8b8d611e006759df796f331f97c /lib/compiler/test | |
| parent | cc57fe8aa7c98c2c3df3d4ea7304c9b53bea1694 (diff) | |
| parent | bf93aa02d98c8d4448b271cac88d6e6b3455f166 (diff) | |
| download | otp-bb4955e083e34be40a9e0d5c0831e5b1498d11df.tar.gz otp-bb4955e083e34be40a9e0d5c0831e5b1498d11df.tar.bz2 otp-bb4955e083e34be40a9e0d5c0831e5b1498d11df.zip | |
Merge branch 'maint'
* maint:
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 96cc846799..11bd5cf07d 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. |
