This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A FrontEnd in C++?

On Thu, Aug 22, 2002 at 09:09:59PM +0200, Gabriel Dos Reis wrote:
> What I find really scary about the current situation is exemplified as
> follows:
>   (1) one makes a C++-only change to cc1plus
>   (2) bootstrap the compiler
>   (3) regress test
>   (4) submit with a clear note about the result of (2) and (3).
> However, (2) doesn't really exercise cc1plus; it does exercise cc1.
> Ahem.  One makes a change to cc1plus and goes on exercising cc1.
> Were cc1plus written in C++, we would be exercising cc1plus after a
> change to cc1plus.  Yes, certainly, one builds the library V3 -- but
> it is just about small instantiations.

Please, everyone, join me in a thought experiment.  Imagine that you
are writing a compiler.  It doesn't matter what language(s) you are
writing in.  You're working under the following constraint: You must
assume that no other component of the system works as specified,
unless you have no choice.  Thus, you trust the operating system
kernel, since you have no choice there.  You just barely trust the
bootstrap compiler(s) to generate correct machine code, when no
optimization is enabled and no clever features of the language(s) are
used.  (Clever features include everything that doesn't have a trivial
translation to machine code.)  You do not trust the language(s)'
runtime librar(ies) to work at all.

Under this constraint, I hope you'll agree with me that the thing to
do is pick just one language, and write your compiler using the most
minimal subset of that language that is practical, also avoiding as
much of the runtime library as is practical.  Under this constraint,
it is a desirable state of affairs that your step (2) above only
exercises a small subset of the compiler you've written.  (Exercising
the rest of the compiler is the function of the test suite.)

Now.  Based on historical evidence, I argue that that's not a thought
experiment at all.  It is instead a slight exaggeration of the
situation we are in, developing GCC.  We have a five-year track record
of having to work around bugs in the C runtime and the bootstrap
compiler.  I see no reason to expect this situation ever to change.
Restricting ourselves to a safe subset of C and C only is a sensible
way to insulate ourselves from these problems as best we can.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]