News for hackers. Stuff that matters.
Re:Show HN: My C compiler compiled itself by mizzao on Wednesday December 04, 2024 @11:48AM (#42319296)
Out of curiosity: would ./30cc_gcc (30cc complied by gcc-hosted 30cc) and ./30cc (30cc complied by self-hosted 30cc) be identical binary files, if 30cc was operating as expected?
Re:Show HN: My C compiler compiled itself by actionfromafar on Wednesday December 04, 2024 @11:57AM (#42319413)
No, gcc optimizes code output and can make code shorter and faster. A compiler can make many, many decisions which will show up as differences in the binary output.
Re:Show HN: My C compiler compiled itself by mizzao on Sunday December 08, 2024 @06:17PM (#42361584)
In my question above, both compilers are 30cc, except one of the 30cc's was compiled by gcc and the other self-hosted.
Re:Show HN: My C compiler compiled itself by actionfromafar on Monday December 09, 2024 @11:38AM (#42367733)
Ah, sorry. In that case, my guess is, probably yes. The outputs of both of these are probably the same. But not for certain - see:

https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_Ref...

Re:Show HN: My C compiler compiled itself by keyvank on Wednesday December 04, 2024 @02:34PM (#42321134)
the asms should be identical, so the binaries should be identical too, unless the linker is undeterministic