This is the mail archive of the gcc-patches@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: PATCH COMMITTED: Don't break tests for enum in range


Paolo Bonzini <bonzini@gnu.org> writes:

> > For the above test case we wind up merging ranges with values for
> > which there is no successor, since the value used in the comparison is
> > already TYPE_MAX_VALUE of the type.  The result is that
> > build_range_check returns a nonsense check.
> 
> I think the fix should be (especially in C --- I'm not sure if the
> test case was broken there too --- but possibly in C++ too) simply not
> to set TYPE_MIN_VALUE/TYPE_MAX_VALUE for enums.  Otherwise, a more
> cunning VRP could perform that optimization on its own, without any
> need for help from fold-const.c.

Yes, that may be a concern as well.  But I think my patch is still
correct in any case.

I think the TYPE_MIN_VALUE/TYPE_MAX_VALUE issue for enums only applies
to C++, not C.  This is because C++ sets the precision to the bounding
precision when it calls set_min_and_max_values_for_integral_types.

Ian


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