This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE (Ada RFC)
On Fri, Aug 05, 2005 at 11:57:45AM -0600, Jeffrey A Law wrote:
> IIRC the C standard does not guarantee that an object stay within
> the bounds of its enumerated type. You'll have to do some digging
> in the relevant standards.
For the record, I believe we've addressed these issues sometime
within the last year or two. The TYPE_MIN/MAX_VALUE for an enum
should be set to the range truely required by the relevant language
standards (different between C and C++).
I don't know for a fact that Ada has been adjusted for this though.
The minimum Definitely Correct change at the moment appears to be
- int width = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (arg1)));
+ int width = TYPE_PRECISION (TREE_TYPE (arg1));
But if an Ada developer can verify that enumerations are correctly
created, we can delete about 100 lines of code. Which would be nice.
r~