logoalt Hacker News

Avshalom • yesterday at 8:33 PM • 1 reply • view on HN

a compiler is only deterministic with respect to itself. It should output identical binaries for identical input, but it's fully expected not to be the sme binary as another compiler. Testable... well Reflections on Trusting Trust and the underhanded c contest, trusting google not to write backdoors into your binary is a little different than trusting anyone with a claude subscription,


Replies

Someone • yesterday at 9:04 PM

> A compiler is only deterministic with respect to itself.

You can compare how its output behaves compared to that of the ‘official’ compiler.

> It should output identical binaries for identical input

Not necessarily, and it’s surprisingly hard to make that happen in modern compilers. Outputs may contain timestamps, file paths, padding inside constant structs may be different, multi-threading in compiler or linker may reorder objects (https://en.wikipedia.org/wiki/Reproducible_builds).

> Reflections on Trusting Trust and the underhanded c contest, trusting google not to write backdoors into your binary is a little different than trusting anyone with a claude subscription

If you compile this compiler multiple times, sometimes with the ‘official’ go compiler, I don’t think that will be a problem. Having non-hidden back doors that are hard to find due to the size of the code, however, can be a problem.

➕ show 1 reply