[PATCH] Fix optimization regression in constant folder
Eric Botcazou
ebotcazou@adacore.com
Mon Sep 17 14:56:00 GMT 2007
> I don't think this is correct. [Note: all this TYPE_IS_SIZETYPE
> specialities have to go somewhen - they really confuse things]
Well, this is the documented behaviour of TYPE_IS_SIZETYPE:
/* In an INTEGER_TYPE, it means the type represents a size. We use
this both for validity checking and to permit optimizations that
are unsafe for other types. Note that the C `size_t' type should
*not* have this flag set. The `size_t' type is simply a typedef
for an ordinary integer type that happens to be the type of an
expression returned by `sizeof'; `size_t' has no special
properties. Expressions whose type have TYPE_IS_SIZETYPE set are
always actual sizes. */
and we really need this to simplify complex size calculations in Ada.
> First of all, this misses a (optimization) testcase. Second, why do we use
> signed sizetype calculations when we want unsigned semantics as far as
> overflow behavior is concerned?
I don't think we want unsigned semantics, we want "size" semantics, i.e we
don't care about overflow in size calculations.
--
Eric Botcazou
More information about the Gcc-patches
mailing list