gcc3 vs 176.gcc

Fergus Henderson fjh@cs.mu.OZ.AU
Thu Jan 10 22:57:00 GMT 2002


On 10-Jan-2002, Zack Weinberg <zack@codesourcery.com> wrote:
> On Thu, Jan 10, 2002 at 03:24:14PM -0800, Richard Henderson wrote:
> > > 
> > > This is an odd way of looking at things.  Consider code that accesses
> > > a private data member in C++ without permission.
> > 
> > That's the difference between undefined behaviour and a constraint
> > violation.  Code with undefined behaviour must compile.
> 
> Not necessarily...
> 
> #include </vmunix>
> 
> is undefined behavior, but I would be very surprised if it compiled
> anywhere.

Right.  But there's a difference between undefined behaviour that occurs
only if a construct is executed, and examples like this one where undefined
behaviour occurs at translation time.  For the former, the code must compile,
unless the compiler can prove that the problematic construct will definitely
be executed (e.g. because it occurs at the start of main()).

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



More information about the Gcc mailing list