UnThreaded | Threaded | Whole Thread (11) | Ignore Thread Prev | Next
Author: JeanDavid Big gold star, 5000 posts Old School Fool CAPS All Star Add to my Favorite Fools Ignore this person (you won't see their posts anymore) Number: of 1648  
Subject: Re: Rare bird Date: 12/11/2011 2:28 PM
Post New | Post Reply | Reply Later | Create Poll Report this Post | Recommend it!
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.
Post New | Post Reply | Reply Later | Create Poll Report this Post | Recommend it!
Print the post  
UnThreaded | Threaded | Whole Thread (11) | Ignore Thread Prev | Next

Announcements

Pencils of Promise - Back to School Drive
"Pencils of Promise works with communities across the globe to build schools and create programs that provide education opportunities for children."
Post of the Day:
Apple

Wal-Mart Nixes Apple Pay
What was Your Dumbest Investment?
Share it with us -- and learn from others' stories of flubs.
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.
Community Home
Speak Your Mind, Start Your Blog, Rate Your Stocks

Community Team Fools - who are those TMF's?
Contact Us
Contact Customer Service and other Fool departments here.
Work for Fools?
Winner of the Washingtonian great places to work, and "#1 Media Company to Work For" (BusinessInsider 2011)! 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.
Advertisement