Compilers like all software, would also be prone to bugs, logical errors.
How does one validate the output generated by the compiler. Typically, my question is(are)
How to validate that the machine code generated is correct?
How to ensure that the machine code generated is according to the language specification.
Does it make sense to just pick an open source project (in C if one is also writing a compiler in C) to just compile it through the "compiler". In that case also, how do judge that the compiler is behaving as expected.
Are there any formal test cases (literature) provided by the language standards committee that a "language complying" compiler has to satisfy?
What are the sure "give aways" that the problem in a program compiled by a compiler is a compiler bug and not a program bug.
- Any examples where mainstream compilers get confused and compile the code wrong?
Links to any literature would be appreciated.
The Eiffel compiler is open source and has an extensive library of test cases and internal design contracts.
http://dev.eiffel.com