This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH COMMITTED: Don't break tests for enum in range
- From: Ian Lance Taylor <iant at google dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 06 Jun 2007 08:25:56 -0700
- Subject: Re: PATCH COMMITTED: Don't break tests for enum in range
- References: <m38xax41qf.fsf@localhost.localdomain> <4666CE46.5040500@gnu.org>
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