This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Stickiness of TYPE_MIN_VALUE/TYPE_MAX_VALUE
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 30 May 2005 22:50:29 +0200
- Subject: Re: Stickiness of TYPE_MIN_VALUE/TYPE_MAX_VALUE
- References: <10505302005.AA08879@vlsi1.ultra.nyu.edu>
* Richard Kenner:
> How sticky are TYPE_MIN_VALUE and TYPE_MAX_VALUE? Is it possible to
> get rid of their effect using a NOP_EXPR, CONVERT_EXPR or
> VIEW_CONVERT_EXPR?
>
> I don't really understand either question. Also, as to the second,
> keep in mind their role in array indexes.
I'll try to phrase it differently: If you access an object whose bit
pattern does not represent a value in the range given by
TYPE_MIN_VALUE .. TYPE_MAX_VALUE of the corresponding type, does this
result in erroneous execution/undefined behavior? If not, what is the
exact behavior WRT to out-of-bounds values?
> If this is impossible, the Ada front end should probably stop setting
> these fields because it assumes that it can use values outside that
> range:
>
> http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gnat_ugn_unw/Validity-Checking.html
>
> I don't understand what that chapter has to do with your statement.
These checks are implemented using the 'Valid attribute (see
Checks.Ensure_Valid and Checks.Insert_Valid_Check).