This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix optimization regression in constant folder
Richard Kenner wrote:
>> Be more specific. Much more. What pathological cases, what optimizations
>> do we suppress currently, which of those are allowed in your system. What
>> properties of the type guarantee this.
>
> We supress reassociation. For a type with undefined overflow, we can't
> convert (a + b) + c into a + (b + c) for fear of the latter expression
> overflowing where the former couldn't. However, this can only very rarely
> happen in practice and only in circumstance I'm calling "pathalogical",
> where A and B have opposite signs, both are large, and where B and C have
> the same sign. But this just can't come up in size and offset computations:
> any negative values are always small.
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?
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713