2 ms·
I've found hundreds of compiler bugs over the years. It's not that hard to find compiler bugs, especially in lesser used compilers. Finding them in the code y
by pfdietz 4y ago
I've found hundreds of compiler bugs over the years. It's not that hard to find compiler bugs, especially in lesser used compilers. Finding them in the code you're writing "in the wild", rather than just for compiler testing, is harder, as the bugs that show up in that sort of code tend to quickly be fixed.
The way to find these bugs is systematic randomized testing, where programs are generated by various random processes, and the compiler tested on them. A bug is found either when the compiler crashes, or the code does something different from similar code (or on a different compiler) that should otherwise perform the same computation. If your compiler has not been subjected to this kind of testing it will inevitably have bugs that this testing will reveal, and possibly a large number of them.
In the compiler I most often test this way (the compiler in the Common Lisp implementation SBCL) it will commonly quickly reveal if new commits (at least, changes that hit the compiler) have bugs. Very handy.