3 ms·
My first thought was, assuming your compiler is self-hosting, run it through itself a series of times. It seems like, if there's something wrong with it (which
by _bxg1 7y ago
My first thought was, assuming your compiler is self-hosting, run it through itself a series of times. It seems like, if there's something wrong with it (which would have to affect its own code, admittedly), its behavior would "drift", getting more wrong with each iteration.
- infogulch 7y agoCompilers aren't a complete - or even representative - sample of source code that they are capable of compiling. If a bad output only manifests with source code that is valid but is not present in the self-hosted compiler's own source code, then this method will never find it.
- _bxg1 7y agoI acknowledged that already. It wouldn't be a comprehensive test, just a novel one that wouldn't rely on there being another compiler available for the same language.
- Dylan16807 7y agoThe drifting you describe would pretty much never happen. The chance of outputting wrong code that affects self-compilation without breaking self-compilation, that then repeats? Very very small. And the compiler's already being used to compile itself all the time, so you're also testing some of the most-tested code.