aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-01-31 08:17:25 +0100
committerBjörn Gustavsson <[email protected]>2015-02-03 08:40:48 +0100
commit8c0bebb66ba01b174e6482cd81949eaf08748bcd (patch)
tree391e0980f8d708c7668376d4cee0d03a18fbf2a1 /erts/emulator
parentc8bbf52191e3c87eedde061051eebcd02dbb7fd5 (diff)
downloadotp-8c0bebb66ba01b174e6482cd81949eaf08748bcd.tar.gz
otp-8c0bebb66ba01b174e6482cd81949eaf08748bcd.tar.bz2
otp-8c0bebb66ba01b174e6482cd81949eaf08748bcd.zip
trace_bif_SUITE: Ensure that a call to time/0 is not removed
Assigning the result of a BIF call to a variable used to be sufficient to prevent the call from being optimized away. With the more aggressive optimization that will be introduced in a future commit it will not be sufficient. Matching the return value will prevent the compiler from doing the optimization.
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/test/trace_bif_SUITE.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/erts/emulator/test/trace_bif_SUITE.erl b/erts/emulator/test/trace_bif_SUITE.erl
index 2c78aa394f..063e348836 100644
--- a/erts/emulator/test/trace_bif_SUITE.erl
+++ b/erts/emulator/test/trace_bif_SUITE.erl
@@ -260,7 +260,9 @@ bif_process() ->
apply(erlang, Name, Args),
bif_process();
{do_time_bif} ->
- _ = time(), %Assignment tells compiler to keep call.
+ %% Match the return value to ensure that the time() call
+ %% is not optimized away.
+ {_,_,_} = time(),
bif_process();
{do_statistics_bif} ->
statistics(runtime),