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: [PATCH] Fix optimization regression in constant folder


On Wed, 10 Oct 2007, Mark Mitchell wrote:

> I've seen people declare C++ objects that map on to huge chunks of the
> entire object space, e.g.:
>   class Everything {
>     char [2 * 1024 * 1024 * 1024];
>   };
> Then, all you need is a derived class, and the offsets from that to the 
> base class will be very large negative numbers.  I'm not sure whether we 
> give those ptrdiff_t type or a signed sizetype type -- but if we're 
> going to have a special type for sizetype, this ought to be one.
> Where does this "negative values are always small" guarantee come from?

It was my understanding during this whole thread, that this sizetype with 
the funny guarantees only can come out of the Ada frontend (and therefore 
needs to be dealt with in the middle end), and should never be produced by 
the other languages, in particular not C or C++.  I realize that this 
currently is not the case (i.e. C/C++ do produce TYPE_IS_SIZETYPE types) 
and my understanding was that this actually is a bug.

It's obvious that C and C++ could _not_ make use of a type with the 
properties that Eric and Richard K. proposed, and as I don't know Ada well 
enough I simply assumed they know what they want and can ensure the 
guarantees they need for that type due to magic restrictions of the 
language itself.

My understanding is supported by the comment in front of the 
TYPE_IS_SIZETYPE definition in tree.h where it explicitely mentions that 
size_t should not have this flag set.


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