Of Bounties and Mercenaries

Bernd Jendrissek berndj@prism.co.za
Wed Apr 7 06:56:00 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Apr 06, 2004 at 09:07:48AM -0500, Chris Lattner wrote:
> On Tue, 6 Apr 2004, Robert Dewar wrote:
> > Chris Lattner wrote:
> > > Andrew Pinski wrote:
> > >
> > >>The other problem with this is that "Modern" "Standard" C++ has the
> > >>following problems:
> > >>1. Makes a mess out of simplifying code from the compiling when the
> > >>compiler is being miscompiled itself.
> > >
> > > Huh?
> >
> > If you really don't understand the above point 1, that's surprising.
> > Have you ever actually worked through problems in a self-compiling
> > bootstrapped compiler? Or are you just arguing language merits?

Anyone (newbies like I, for example ;) doubting the nastiness of
diagnosing a miscompiled *compiler* (not just its output) should
immediately go and read the ACM Classic: Reflections on Trusting Trust:

http://www.acm.org/classics/sep95/

The simple example of teaching a compiler to understand '\n' etc.
without having any mapping of 'n' => 012 anywhere in its source code (if
you don't grasp the profoundness of this, think about it again, until
you do), should indicate how weird a miscompiled compiler can be: it can
end up injecting bugs into your programs without the bug having any
source code!  The compiler can "learn" to bugify your code, and will
remember to do so even *after* you've eliminated the ultimate source of
the problem.

That's why it's a good idea to bootstrap GCC regularly with a non-GCC
compiler.  (I guess an ancient GCC would be a sufficiently close
approximation to a non-GCC compiler as most people will bother to get.
I happen to have gcc-2.7.2.3 around, and in my copious free time I
occasionally (in between bouts of FreeCiv) try to get gcc-2.5.8 going.)

Truly profound, this bootstrapping stuff.  Read that paper, co-newbies.
(And no, I'm not smoking anything.)

All of this also makes me want to see a *separate* C compiler that's
also free software, that is capable of bootstrapping GCC.  tcc (?)
springs to mind, but last I checked it barfed in libiberty.  On and off
I also play around with a bootstrap toolchain, which I eventually hope
to teach to compile C.  Progress is painfully slow, but it's fun!

Ah, another page springs to mind, where this guy has *done* much of the
work of bootstrapping a compiler from nothing, instead of just
daydreaming about it:

http://homepage.ntlworld.com/edmund.grimley-evans/bcompiler.html

- -- 
http://voyager.abite.co.za/~berndj/ (up again for now - yay!)
I've generally found that the fastest way to get the right answer on the net
is to confidently assert the answer you believe to be right; those who know
will immediately correct you, while if you just ask, often no answers arrive.
All it requires is a willingness to look bad on occasion.
                                               - Joe Buck on gcc@gcc.gnu.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFAc6Tn/FmLrNfLpjMRAtwdAJ9qME6cZMub7cKNFDfi2/P6j6zulwCgpjoM
w1VxOKeh7qP+KoTysniTXEE=
=wJAG
-----END PGP SIGNATURE-----



More information about the Gcc mailing list