Roberto said:
[OT] No, (at least not as worded) A simple test that every
self-compiling compiler should pass, is that when compiling its own
sources it should produce exact duplicates of itself.
Not necessarily.
The order in which subexpressions are evaluated is compiler-dependent.
For example, if we have a function
int f (void* p);
then it is compiler-dependent whether in the expression
f (right) + f (left)
f (right) is called first or f (left) is called first.
Now assume that your compiler A has a function codegen (), and when
the compiler wishes to generate code for two function calls in
unspecified order, with the results discarded, it calls
codegen (right_tree) + codegen (left_tree)
Lets say we compile this with a compiler X, which calls the left
function first. So the assembler code in the compiled code is
codegen (right_tree)
codegen (left_tree)
Compile the compiler using the compiler compiled by X. The assembler
code will now be
codegen (left_tree)
codegen (right_tree).
Compile the compiler with the generated code. The assembler code will
be
codegen (right_tree)
codegen (left_tree)
and so on. All the even versions are different from all the odd
versions.