On 9/10/20, Edouard Klein <edouardklein(a)gmail.com> wrote:
Adding a bit of context, Software Heritage is used for
example by GNU
Guix, which aims at making builds reproducible down to the exact bit.
To get complete build reproducibility, your compiler writers have to
be careful. It's very easy to introduce random variability that
doesn't affect the performance or semantics of the program. Register
choice and instruction ordering, for example. Here's a real-world
example of how such things can happen. Compilers have lots of data
structures (temporary variables, for example) that require unique
identifiers, but the value of the identifier is irrelevant--it simply
has to be unique. It's tempting to use the memory address of the data
structure as the unique ID--it saves both space and time. But suppose
that your register allocator has to index those items in a hash table,
and also at some point sequentially walks the hash table. The order
of the sequential walk is now dependent on the memory addresses of the
items in the table. In the case I observed, this resulted in
different register choices if the program was recompiled.
-Paul W.