diff options
author | John Högberg <[email protected]> | 2018-07-16 15:21:04 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-08-08 13:10:45 +0200 |
commit | a2b94643d345505bcee103b114147e3cb962b8ac (patch) | |
tree | 77b7405d816b0021d1ebb72f4a5c38d2c76587b4 /erts | |
parent | 212e8b4caa9968d50f0701ce70aa0ebe5b25f1a6 (diff) | |
download | otp-a2b94643d345505bcee103b114147e3cb962b8ac.tar.gz otp-a2b94643d345505bcee103b114147e3cb962b8ac.tar.bz2 otp-a2b94643d345505bcee103b114147e3cb962b8ac.zip |
Fix side-effect optimization when compiling from Core Erlang
When an expression is only used for its side effects, we try to
remove everything that doesn't tie into a side-effect, but we
went a bit too far when we applied the optimization to funs
defined in such a context. Consider the following:
do letrec 'f'/0 = fun () -> ... whatever ...
in call 'side':'effect'(apply 'f'/0())
'ok'
When f/0 is optimized under the assumption that its return value
is unused, side:effect/1 will be fed the result of the last
side-effecting expression in f/0 instead of its actual result.
https://bugs.erlang.org/browse/ERL-658
Co-authored-by: Björn Gustavsson <[email protected]>
Diffstat (limited to 'erts')
0 files changed, 0 insertions, 0 deletions