Message Font: Serif | Sans-Serif
No. of Recommendations: 0
it's that very rare bird, a bona fide compiler bug.

I can do you one better, and it was a compiler bug I created without even touching the compiler source code.

I was one of two people writing an optimizer for the C compiler at Bell Labs. The way the compilation system worked, in those days, was for the compiler to produce a temporary file in assembly language and pass that file to the assembler. The way we designed the optimizer was to have it read the assembly code, optimize it, and put the optimized code into the assembler. That way, we could take the output of the C compiler, the C++ compiler (that did the same thing in those days), the FORTRAN compiler and run them all through the same optimizer and pipe it into the assembler.

Well, I put a bug in the assembler that was only activated in some unusual code sequence. We had already run regression tests on both the C++ and C compilers, even built the whole UNIX kernel and tested that, and everything worked fine.

Only trouble was that it made a slight error in compiling one particular program: the FORTRAN compiler. The FORTRAN compiler passed its regression tests, but a user got errors in his FORTRAN program. When all was said and done, we discovered the problem and I fixed it in a minute or two. But we first tried to find the error in the users program, and there was no error. We had not modified the FORTRAN compiler, so it could not have been the compiler -- but it was the only program we had that gave wrong results, namely bad executable programs. We rebuilt it with the optimizer turned off, and then it worked OK. So we knew it had to be the optimizer.

Some problems are not easy to understand, are hard to find and, fortunately, are easy to fix.
Print the post  


When Life Gives You Lemons
We all have had hardships and made poor decisions. The important thing is how we respond and grow. Read the story of a Fool who started from nothing, and looks to gain everything.
Contact Us
Contact Customer Service and other Fool departments here.
Work for Fools?
Winner of the Washingtonian great places to work, and Glassdoor #1 Company to Work For 2015! Have access to all of TMF's online and email products for FREE, and be paid for your contributions to TMF! Click the link and start your Fool career.