Stickiness of TYPE_MIN_VALUE/TYPE_MAX_VALUE
Florian Weimer
fw@deneb.enyo.de
Mon May 30 23:15:00 GMT 2005
* 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).
More information about the Gcc
mailing list