aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/beam_ssa_SUITE.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-07-10 15:41:13 +0200
committerJohn Högberg <[email protected]>2019-07-10 18:04:45 +0200
commit9ca0e82455297040069b8274649e7ddd28a5d65b (patch)
treee26660518783d87e46262d38d51207e73e7f582e /lib/compiler/test/beam_ssa_SUITE.erl
parentfa5e2cae48323a391ff65512a972d6c9f4ba4119 (diff)
downloadotp-9ca0e82455297040069b8274649e7ddd28a5d65b.tar.gz
otp-9ca0e82455297040069b8274649e7ddd28a5d65b.tar.bz2
otp-9ca0e82455297040069b8274649e7ddd28a5d65b.zip
compiler: Fix compiler crash introduced by OTP-15952
An assertion in code generation would fail when the common exit block was ?BADARG_BLOCK, as some operations expect to always "fail" directly to that block (= throw an exception) and we had inserted a dummy block in between. Other operations could also get funny fail labels, jumping to blocks that immediately jumped to {f,0}, but these were all cleaned up by beam_jump, sweeping the bug under the rug.
Diffstat (limited to 'lib/compiler/test/beam_ssa_SUITE.erl')
-rw-r--r--lib/compiler/test/beam_ssa_SUITE.erl15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/compiler/test/beam_ssa_SUITE.erl b/lib/compiler/test/beam_ssa_SUITE.erl
index 256bb95559..dd1b7ddcd3 100644
--- a/lib/compiler/test/beam_ssa_SUITE.erl
+++ b/lib/compiler/test/beam_ssa_SUITE.erl
@@ -196,6 +196,9 @@ recv(_Config) ->
self() ! 2,
b = tricky_recv_5(),
+ %% tricky_recv_6/0 is a compile-time error.
+ tricky_recv_6(),
+
ok.
sync_wait_mon({Pid, Ref}, Timeout) ->
@@ -321,6 +324,18 @@ tricky_recv_5() ->
_:_ -> c
end.
+%% When fixing tricky_recv_5, we introduced a compiler crash when the common
+%% exit block was ?BADARG_BLOCK and floats were in the picture.
+tricky_recv_6() ->
+ RefA = make_ref(),
+ RefB = make_ref(),
+ receive
+ {RefA, Number} -> Number + 1.0;
+ {RefB, Number} -> Number + 2.0
+ after 0 ->
+ ok
+ end.
+
maps(_Config) ->
{'EXIT',{{badmatch,#{}},_}} = (catch maps_1(any)),
ok.