6 ms·
> The same source code should generate the same binary. This is utterly false and reveals a deep misunderstanding of compiler technology. Aside from optimizati
by InclinedPlane 13y ago
> The same source code should generate the same binary.
This is utterly false and reveals a deep misunderstanding of compiler technology. Aside from optimizations and exactly how they are implemented in each compiler there are still many more or less arbitrary choices that a compiler needs to make in order to translate source code into machine code. Address layout being one of the most prevalent. Indeed, these choices are so arbitrary and lead to such a high degree of difference in the binary forms that the same compiler running on the same code will often generate different binary output. And the same compilers running on very slightly different code bases will quickly generate substantially divergent output. This is why programs like bsdiff and courgette exist, because comparing binaries is actually an enormously non-trivial problem.
- WalterBright 13y ago> This is utterly false and reveals a deep misunderstanding of compiler technology. I've written many professional compilers, front to back, and I use the binary difference technique to verify that the compiler is capable of exactly reproducing itself. If you've got a compiler that generates different binaries depending on the time of day, the address the compiler was loaded at, or something else that is not the compiler switches + source code provided to it, you've got a compiler with serious QA issues.
- InclinedPlane 13y agoThat's nice that your compiler works that way but that's not the way most do. More importantly the salient point was about comparing the binary output of different compilers. While it's certainly possible to create tools which make it make it possible to determine if the binary output of different compilers are effectively the same such tools are very non-trivial to create. The idea that different compilers are likely to produce exactly identical output is sheer fantasy.
- e12e 13y agoNo, the point was comparing the binary output of the same compiler, compiled by itself, compiled by different compilers... (Yeah, I missed that the first time round, too).
- WalterBright 13y ago> More importantly the salient point was about comparing the binary output of different compilers. No, it wasn't. I explained it (apparently badly) 3 times now. There's another iteration of bootstrap compiling in there before the output is compared.
- chii 13y agoI think a lot of people gets confused by your explanation earlier in the comment thread because one it is difficult to do recursion, and two, see above. ;) But yes, i think this method does work. You'd have to trust all the pipeline programs used in between.
- Patient0 13y agoNext time you might want to look up who Walter Bright is before jumping to the conclusion that you know more about compilers than he does (http://en.wikipedia.org/wiki/Walter_Bright http://en.wikipedia.org/wiki/Walter_Bright)