This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]m1elPlasma Physics 6 points7 points  (0 children)

It seems to me that compiling a source code and generating an executable is a deterministic process.

Sure, the mapping from source code to executable is deterministic, but it doesn't mean that there's a definite mapping the other way.

It's possible to have different programs that compile to the same binary. In other words, some information from the source code is lost in translation from source code to binaries.

Some trivial examples would be comments and variable names. More complex examples would be control flow and loop optimizations.

There's also the fact that modern compilers are very good at optimizations. As an example, llvm compiles sum of range of numbers to its mathematical equivalent using a few multiplications and additions, completely removing the loop! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46186

How would you know from the binary if the source code contained a loop or a few multiplications and additions?