On 24/05/2012 20:26, Chuck Guzis wrote:
On Wed, 23 May 2012, Stefan Skoglund wrote:
> The best test suite there is for a compiler:
> ITSELF.
Not true. I spent ages trying to fix a bug in the old IBM370 GCC code
generator. It looked like the floating point was failing but it was
actually generating code for unsigned short operations.
The normal
workflow when compiling gcc is to have it build itself.
One of the last steps before installation was to check for
differences between one build of the compiler and the result of
the
same build iteration build of itself.
Speaking as an old compiler wrangler, I strongly dispute this
statement. People who write compilers (and I'm one of them) tend to
be blind to various aspects of the language. While a compiler may
consistently produce working code from the source that you yourself
write, a compiler author should never be allowed near the testing of
the product.
For ANSI-specified products, there are standards conformance and
autiting tests. One of my fondest nightmares was running the Navy
COBOL audit tests against a new version of the compiler.
You see, there are several types of errors. There are the "this
generates code, but the code doesn't work" type of tests and then
there's the "I can write this statement and produce working code, but
the standard says that it's an error to accept the statement at all"
type of test. Some of the more frustrating tests can be those that
test conformance with the language specification.
Optimization can be another great steaming mass of trouble. Some
optimizations may appear to be benign, but turn out to be anything
but.
For a language as vast as C++, I'd never trust any code that I wrote
to find all of the chinks in the armor.
--Chuck