Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers > Re: Bootstrapin...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 19 Topic 2388 of 2472
Post > Topic >>

Re: Bootstraping compilers ?

by Chris Hills <chris@[EMAIL PROTECTED] > Apr 18, 2008 at 11:45 AM

Paulo Jorge de O. C. de Matos <pocm@[EMAIL PROTECTED]
> writes
>I am wondering if a compiler should always be able to compile
>itself. gcc for example seems to do it, but is this good practice or
>should this always happen?

No. Many compilers are cross compilers (the target is not the same as
the host).  For this reason many Gcc compilers may not be able to
compile themselves either.

>My guess is that this is definitely not necessary.

That is a different question. (Assuming host and target are the same).
Being able to easily do something and it being necessary are two
different things.

>Imagine developing a compiler for C99 written in C89. In this case,
>we would have a C99 compiler not able to compile itself, right?
>[given that I don't think that C89 is a subset of C90]

C89 is a subset of C90... :-) but you are correct that C89/90 is not the
same as C99.

However once you have written a C99 compiler (using C95) you can then
write a C99 compiler and compile it with itself (after the first
compilation using the C99 compiler written in C95)

The first compiler for a new version of the language will always have
to be compiled with the old compiler. After that it should be able to
compile itself assuming the host and target are the same.

>test it.  On the third hand, read this Ken Thompson classic
>http://cm.bell-labs.com/who/ken/trust.html
-John]

This of course is the well known login legend. This is not a problem
where the source code is not available as in most commercial
compilers.  So MS may have a hack in the compiler but only MS would
know this and it will seriously harm their business if word of it ever
gets out.

For things like the Gcc compilers where the source is readily
available from multiple sources :-) it is another matter.  One could
"infect" a compiler and spread that binary around where it would
indeed infect any other compiler compiled with it.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
[By the way, it's not a legend.  Ken really did it. -John]
 




 19 Posts in Topic:
Bootstraping compilers ?
pocm@[EMAIL PROTECTED] (  2008-04-16 22:30:21 
Re: Bootstraping compilers ?
Chris Hills <chris@[EM  2008-04-18 11:45:12 
Re: Bootstraping compilers ?
pocm@[EMAIL PROTECTED] (  2008-04-22 00:07:22 
Re: Bootstraping compilers ?
David Spencer <spencer  2008-04-22 16:05:51 
Re: Bootstraping compilers ?
Hans-Peter Diettrich <  2008-04-22 20:07:33 
Re: Bootstraping compilers ?
=?ISO-8859-1?Q?Roland_Lei  2008-04-18 07:32:18 
Re: Bootstraping compilers ?
Marco van de Voort <ma  2008-04-18 19:32:59 
Re: Bootstraping compilers ?
"Damian Thomas"  2008-04-18 08:46:51 
Re: Bootstraping compilers ?
Marco van de Voort <ma  2008-04-18 19:38:29 
Re: Bootstraping compilers ?
"Christopher Glaeser  2008-04-19 23:42:06 
Re: Bootstraping compilers ?
Greg Lindahl <lindahl@  2008-04-18 14:13:55 
Re: Bootstraping compilers ?
torbenm@[EMAIL PROTECTED]  2008-04-21 10:35:52 
Re: Bootstraping compilers ?
Hans-Peter Diettrich <  2008-04-21 20:22:33 
Re: Bootstraping compilers ?
glen herrmannsfeldt <g  2008-04-21 21:18:53 
Re: Bootstraping compilers ?
glen herrmannsfeldt <g  2008-04-23 00:47:23 
Re: Fortran H, was Bootstraping compilers ?
"Comp.compilers"  2008-04-23 21:15:42 
Re: Fortran H, was Bootstraping compilers ?
=?ISO-8859-1?Q?J=FCrgen_K  2008-04-24 17:59:13 
Re: Fortran H, was Bootstraping compilers ?
glen herrmannsfeldt <g  2008-04-25 12:57:11 
Re: Fortran H, was Bootstraping compilers ?
glen herrmannsfeldt <g  2008-04-24 10:07:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 14:37:21 CDT 2008.