aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-08-15 12:37:49 +0200
committerBjörn Gustavsson <[email protected]>2018-08-15 12:37:49 +0200
commit5a65083ec68d57c5ad2b267ad2d089947b3fd5a0 (patch)
tree780c31e7f3bd5fccda931908b605a16e1139753f /lib/compiler/test
parentbbff5e508db9a5e9218e2902f30766fe53df36a8 (diff)
parentdacfafd97ed955b9c567f0efbc8553286360b0d2 (diff)
downloadotp-5a65083ec68d57c5ad2b267ad2d089947b3fd5a0.tar.gz
otp-5a65083ec68d57c5ad2b267ad2d089947b3fd5a0.tar.bz2
otp-5a65083ec68d57c5ad2b267ad2d089947b3fd5a0.zip
Merge branch 'maint'
* maint: Fix compiler crash when compiling double receives erts: Delete fd from poll-set when closing fd_driver port
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/receive_SUITE.erl32
1 files changed, 30 insertions, 2 deletions
diff --git a/lib/compiler/test/receive_SUITE.erl b/lib/compiler/test/receive_SUITE.erl
index 37e737084a..4219768d6f 100644
--- a/lib/compiler/test/receive_SUITE.erl
+++ b/lib/compiler/test/receive_SUITE.erl
@@ -25,7 +25,7 @@
init_per_group/2,end_per_group/2,
init_per_testcase/2,end_per_testcase/2,
export/1,recv/1,coverage/1,otp_7980/1,ref_opt/1,
- wait/1,recv_in_try/1]).
+ wait/1,recv_in_try/1,double_recv/1]).
-include_lib("common_test/include/ct.hrl").
@@ -45,7 +45,7 @@ all() ->
groups() ->
[{p,test_lib:parallel(),
[recv,coverage,otp_7980,ref_opt,export,wait,
- recv_in_try]}].
+ recv_in_try,double_recv]}].
init_per_suite(Config) ->
@@ -349,5 +349,33 @@ recv_in_try(Timeout, Format) ->
{nok,Reason}
end.
+%% ERL-703. The compiler would crash because beam_utils:anno_defs/1
+%% failed to take into account that code after loop_rec_end is
+%% unreachable.
+
+double_recv(_Config) ->
+ self() ! {more,{a,term}},
+ ok = do_double_recv({more,{a,term}}, any),
+ self() ! message,
+ ok = do_double_recv(whatever, message),
+
+ error = do_double_recv({more,42}, whatever),
+ error = do_double_recv(whatever, whatever),
+ ok.
+
+do_double_recv({more, Rest}, _Msg) ->
+ receive
+ {more, Rest} ->
+ ok
+ after 0 ->
+ error
+ end;
+do_double_recv(_, Msg) ->
+ receive
+ Msg ->
+ ok
+ after 0 ->
+ error
+ end.
id(I) -> I.