[PATCH] Remove bogus TYPE_IS_SIZETYPE special-casing in extract_muldiv_1

Eric Botcazou ebotcazou@adacore.com
Fri Sep 2 08:37:00 GMT 2011


> Well, the comment for that folding is totally odd - of _course_
> unsigned sizetype things can overflow (we hid that issue merely
> by pretending all unsigned sizetype constants (yes, only constants)
> are signed.  Huh.)

It's again the special semantics of sizetypes whereby we pretend that they 
don't overflow.  I know your opinion about this, but this is documented:

/* 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.  */
#define TYPE_IS_SIZETYPE(NODE) \
  (INTEGER_TYPE_CHECK (NODE)->type_common.no_force_blk_flag)

and we rely on these optimizations to simplify size computations in Ada.

> 2011-08-31  Richard Guenther  <rguenther@suse.de>
>
> 	* fold-const.c (extract_muldiv_1): Remove bogus TYPE_IS_SIZETYPE
> 	special-casing.

IMO you shouldn't commit this kind of patchlets without the final big patch.

-- 
Eric Botcazou



More information about the Gcc-patches mailing list