Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.compilers Subject: Re: self-hosting, was Writing A Plain English Compiler Date: Wed, 12 Nov 2014 08:46:31 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 42 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-11-031@comp.compilers> References: <14-11-004@comp.compilers> <14-11-005@comp.compilers> <14-11-007@comp.compilers> <14-11-014@comp.compilers> <14-11-016@comp.compilers> <14-11-020@comp.compilers> <14-11-028@comp.compilers> <14-11-029@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: miucha.iecc.com 1415783253 32326 2001:470:1f07:1126:0:676f:7373:6970 (12 Nov 2014 09:07:33 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Wed, 12 Nov 2014 09:07:33 +0000 (UTC) Keywords: debug, practice Posted-Date: 12 Nov 2014 04:07:33 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1439 "BartC" writes: >It does, however, run into problems, such as frequently ending up with >non-working compilers and/or support programs, and with most of the bridges >burnt! Then recovering can be tricky. To deal with that, you have a "stable" and executable (or buildable) version somewhere, and make sure that your compiler builds with that version. So if the current version no longer builds with itself, you build it with the stable version; for that you also need a simple way to switch from building with the current version (default) to building with the stable version. E.g., if Gforth no longer builds itself because of some bug, we do "make distclean" and invoke the script "BUILD_FROM_SCRATCH", which invokes the stable version of Gforth for the self-hosting. >It is possible to compile a compiler with itself, and perhaps even repeat >that again, but still end up with something that apparently still works, but >has now developed a bug. Perhaps because it affects some code that is not >executed in the compiler, because the particular language construct to >invoke the bug doesn't occur in the compiler source. Sure, a test cannot prove the absence of bugs. You need additional tests, especially for features not exercised in the compiler (say, vectorization). >[It's time to reread Ken Thompson's Turing award lecture, >available here: http://cm.bell-labs.com/who/ken/trust.html >-John] Self-hosting does not make binary distributions of code (including compilers) any more prone to hidden functions. These days we have even more stuff to worry about, with stuff like system-management mode and VM functionality making it very easy to hide functions, and huge amounts of code in the firmware of the PC, or even in the firmware of USB sticks. - anton -- M. Anton Ertl anton@mips.complang.tuwien.ac.at http://www.complang.tuwien.ac.at/anton/