This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fold and integer types with sub-ranges


> Sure - I wonder if there is a reliable way of testing whether we face
> a non-base type in the middle-end.  I suppose TREE_TYPE (type) != NULL
> won't work in all cases... (?)

That's the right way as far as I know.

> I agree.  But appearantly fold does not care about base vs. non-base
> types and happily strips conversions between them, doing arithmetic
> in the non-base type.

I think that's fine assuming it does so only when it's safe to do so.
My point was that if we need do the sorts of arithmetic you suggested (a+1,
where "1" is not in the type of "a"), that we have to generate the same
sorts of conversions, which in this case, fold can't strip off (because it
would create an invalid constant).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]