The LLVM Project Blog did an interesting comparison of compiling error messages using clang and gcc.

Out of curiosity I took the 15 test cases published in the blog entry and tested them against Sun Solaris Studio Pro compilers (under Solaris) and a recent GCC (4.5 under Ubuntu).


You can find the complete results in the out subdirectory.

The Sun Studio error message does not really change between major versions 11 and 12. Surprisingly, test case does not produce a compiler error message. Only the linking fails because the missing definition of main(). But the compiler is expected to error out because of ambiguity. Both clang and GCC report the ambiguity.

The first test fails because Sun Studio does not support Objective C (but it reports .m as unsupported file extension, which is helpful).

The GCC 4.5 results are comparable to the ones shown in the llvm blog entry, but gcc 4.5 adds column information to the output. The .m test case fails with a exec error message because the gcc objective C package is not installed.


For example to test a gcc:

$ bash gcc gcc | tee gcc

Or for the Sun compiler:

$ PATH=/vol/studio-12.2/bin:$PATH bash cc CC | tee spro-12.2

Test Cases

Cases 0[1-9]_ and 1[0-5]_ are from Amazing feats of Clang Error Recovery.


You can reach me via email: