aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/test/basic_SUITE_data/basic_bugs_beam.erl
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2014-03-04 14:05:49 +0100
committerKostis Sagonas <[email protected]>2015-12-16 22:08:32 +0100
commit6a645e07a02f9adda9b9534214e699ad8f30a15f (patch)
tree204668b974388eeb551ec14a4e52c7ee535acb92 /lib/hipe/test/basic_SUITE_data/basic_bugs_beam.erl
parent9fd2f21c38944c8a605020d6662bb5935c5bbee2 (diff)
downloadotp-6a645e07a02f9adda9b9534214e699ad8f30a15f.tar.gz
otp-6a645e07a02f9adda9b9534214e699ad8f30a15f.tar.bz2
otp-6a645e07a02f9adda9b9534214e699ad8f30a15f.zip
More basic tests
and some tests that the HiPE compiler is not causing trouble
Diffstat (limited to 'lib/hipe/test/basic_SUITE_data/basic_bugs_beam.erl')
-rw-r--r--lib/hipe/test/basic_SUITE_data/basic_bugs_beam.erl37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/hipe/test/basic_SUITE_data/basic_bugs_beam.erl b/lib/hipe/test/basic_SUITE_data/basic_bugs_beam.erl
index 0cf9a3cd4c..964b0f423a 100644
--- a/lib/hipe/test/basic_SUITE_data/basic_bugs_beam.erl
+++ b/lib/hipe/test/basic_SUITE_data/basic_bugs_beam.erl
@@ -8,6 +8,8 @@
-export([test/0]).
+%% the following is needed for the test_weird_message
+-export([loop/1]).
%% the following are needed for the test_catch_bug
-behaviour(gen_server).
-export([start_link/1]).
@@ -16,6 +18,7 @@
test() ->
ok = test_fp_basic_blocks(),
+ ok = test_weird_message(),
ok = test_catch_bug(),
ok.
@@ -64,6 +67,40 @@ bad_arith2(X, Y) when is_float(X) ->
{X1 + 1.0, Y1}.
%%--------------------------------------------------------------------
+%% Sending 'test' to this process should return 'ok'. But:
+%%
+%% 1> MOD:test().
+%% Weird: received true
+%% timeout
+%%
+%% Surprisingly, the message has been bound to the value of 'ena'
+%% in the record! The problem was visible in the .S file.
+%%--------------------------------------------------------------------
+
+-record(state, {ena = true}).
+
+test_weird_message() ->
+ P = spawn_link(?MODULE, loop, [#state{}]),
+ P ! {msg, self()},
+ receive
+ What -> What
+ after 42 -> timeout
+ end.
+
+loop(S) ->
+ receive
+ _ when S#state.ena == false ->
+ io:format("Weird: ena is false\n");
+ % loop(S);
+ {msg, Pid} ->
+ Pid ! ok;
+ % loop(S);
+ Other ->
+ io:format("Weird: received ~p\n", [Other])
+ % loop(S)
+ end.
+
+%%--------------------------------------------------------------------
%% This was posted on the Erlang mailing list as a question:
%%
%% Given the module below and the function call