4 ms·
Having done research on finding miscompilations in production compilers just recently[1], hunting a couple hundred bugs in GCC and LLVM, I feel much more skepti
by mehrdada 12y ago
Having done research on finding miscompilations in production compilers just recently[1], hunting a couple hundred bugs in GCC and LLVM, I feel much more skeptical these days about this matter.
Modern compilers are big, complex, systems, and naturally have bugs (to be fair, given the complexity and aggressiveness of optimizations, the quality of GCC is extremely admirable.)
[1]: http://mehrdadafshari.com/emi/paper.pdf http://mehrdadafshari.com/emi/paper.pdf (check out the example bugs in the paper. They are amusing.)
P.S. The "it's your code, not the compiler" mindset does not generally apply to compilers targeting embedded platforms.
- makomk 12y agoOh wow, those example compiler bugs are really interesting. Turns out aggressive removal of code that invokes undefined behaviour can combine with common, safe optimisations to cause misoptimisation - even though the code output by the earlier optimisation passes was safe due to implementation details, a subsequent pass decided that because the optimised code's behaviour wasn't defined by the C standard it could assume it never executed and remove chunks of it. Nasty.