This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [lto] RFC: How should gimple represent enums?
On Thu, Mar 12, 2009 at 5:50 PM, Diego Novillo <dnovillo@google.com> wrote:
> On Thu, Mar 12, 2009 at 12:46, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
>> On Thu, Mar 12, 2009 at 5:36 PM, Diego Novillo <dnovillo@google.com> wrote:
>>> The temptation is to use C++'s limits, but I'm concerned that may
>>> produce confusion somewhere down the line with the optimizers or other
>>> diagnostics. ?Or should we use C's notion and treat them as ints?
>>
>> The limits are a language-specific thing that the front end should check for.
>
> Right, but we do take advantage of them in the middle end in various
> places (VRP, switch warnings, etc). ?Using one or the other will
> probably affect what we do there. ?I have no data on whether this is
> true, though, it's only intuition from the fact that we do make
> decisions based in TYPE_{MAX,MIN}_VALUE.
>
>
>> But from the point of view of the middle-end, an enum value is just a
>> number. ?So IMHO: Use ints.
>
> That's true.
I agree with Steven. It is not clearly defined what to do with for example
out-of-range constants, so any means to avoid that situation is good.
Richard.