This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFC: Ensure TREE_TYPE (TYPE_MIN_VALUE (t)) == t
- From: Ian Lance Taylor <iant at google dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: dnovillo at redhat dot com, rguenther at suse dot de, gcc-patches at gcc dot gnu dot org
- Date: 27 Apr 2007 15:57:41 -0700
- Subject: Re: PATCH RFC: Ensure TREE_TYPE (TYPE_MIN_VALUE (t)) == t
- References: <m3vefh3dm9.fsf@localhost.localdomain> <20070427220712.GB16083@redhat.com>
Richard Henderson <rth@redhat.com> writes:
> On Fri, Apr 27, 2007 at 10:56:30AM -0700, Ian Lance Taylor wrote:
> > VRP currently assumes that TREE_TYPE (TYPE_MIN_VALUE (t)) == t.
>
> I'd say that this is a bug in the same way that any other
> direct type comparison is flawed. I'd suggest that
>
> TYPE_MAIN_VARIANT (TREE_TYPE (TYPE_MIN_VALUE (t)))
> == TYPE_MAIN_VARIANT (t)
>
> is the correct test. That certainly handles your typedef case.
Well, VRP never actually does the type comparison that I wrote. The
real question is whether, given a NEGATE_EXPR applied to 'max', this
test is flawed:
if (max != TYPE_MIN_VALUE (TREE_TYPE (max)))
Before the patch I just committed (but will revert if it seems wrong),
that test in VRP was unreliable for a typedef: because TREE_TYPE (max)
and TYPE_MIN_VALUE (TREE_TYPE (max)) were different, max and
TYPE_MIN_VALUE (...) could have the same value but not be ==.
Ian