Re: self-hosting, was Writing A Plain English Compiler

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Wed, 12 Nov 2014 08:46:31 GMT

          From comp.compilers

Related articles
[3 earlier articles]
Re: Writing A Plain English Compiler Pidgeot18@verizon.net (=?UTF-8?Q?Joshua_Cranmer_=f0=9f=90=a7?=) (2014-11-07)
Re: Writing A Plain English Compiler gerry.rzeppa@pobox.com (Gerry Rzeppa) (2014-11-08)
Re: Writing A Plain English Compiler bc@freeuk.com (BartC) (2014-11-09)
Re: self-hosting, was Writing A Plain English Compiler portempa@aon.at (Richard Hable) (2014-11-11)
Re: self-hosting, was Writing A Plain English Compiler bc@freeuk.com (BartC) (2014-11-11)
Re: self-hosting, was Writing A Plain English Compiler anton@mips.complang.tuwien.ac.at (2014-11-12)
Re: self-hosting, was Writing A Plain English Compiler anton@mips.complang.tuwien.ac.at (2014-11-12)
Re: self-hosting, was Writing A Plain English Compiler bc@freeuk.com (BartC) (2014-11-12)
| List of all articles for this month |

From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: Wed, 12 Nov 2014 08:46:31 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 14-11-004 14-11-005 14-11-007 14-11-014 14-11-016 14-11-020 14-11-028 14-11-029
Keywords: debug, practice
Posted-Date: 12 Nov 2014 04:07:33 EST

"BartC" <bc@freeuk.com> 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/


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.