erlang / otp

Erlang/OTP

Home Page:http://erlang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiler nondeterministic behaviour

delitrem opened this issue · comments

Describe the bug
Compiler sometimes generates different beams for some sources.
(It seems this behaviour is somehow related to -doc() attributes and maps in beams.)

To Reproduce

$ cd path/to/erlang/otp
$ for a in $(seq 1 10); do make; md5sum lib/ssh/ebin/ssh_sftp.beam >> ../result.txt; rm lib/ssh/ebin/ssh_sftp.beam; done
$ cat ../result.txt
186705d7c040a85b938c7871305c34fe  lib/ssh/ebin/ssh_sftp.beam
186705d7c040a85b938c7871305c34fe  lib/ssh/ebin/ssh_sftp.beam
d4f1dc07cd63e00170723af6e174eee2  lib/ssh/ebin/ssh_sftp.beam
186705d7c040a85b938c7871305c34fe  lib/ssh/ebin/ssh_sftp.beam
186705d7c040a85b938c7871305c34fe  lib/ssh/ebin/ssh_sftp.beam
186705d7c040a85b938c7871305c34fe  lib/ssh/ebin/ssh_sftp.beam
186705d7c040a85b938c7871305c34fe  lib/ssh/ebin/ssh_sftp.beam
186705d7c040a85b938c7871305c34fe  lib/ssh/ebin/ssh_sftp.beam
186705d7c040a85b938c7871305c34fe  lib/ssh/ebin/ssh_sftp.beam
186705d7c040a85b938c7871305c34fe  lib/ssh/ebin/ssh_sftp.beam

Expected behavior
Compiler generates the same data.

Affected versions
OTP-27.0, git master.

If you use the configure flag --enable-deterministic-build that shouldn't happen.

The same behaviour with ./configure --enable-deterministic-build.

After applying provided patch, then updating bootstrap, everything works as expected.

Fix will be part of OTP-27.0.1.