This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Committed] PR26361: Handle unsigned NEGATE_EXPR in VRP
- From: Jeffrey A Law <law at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 21 Feb 2006 10:12:08 -0700
- Subject: Re: [Committed] PR26361: Handle unsigned NEGATE_EXPR in VRP
- References: <Pine.LNX.4.44.0602201914460.15835-100000@www.eyesopen.com>
- Reply-to: law at redhat dot com
On Mon, 2006-02-20 at 19:27 -0700, Roger Sayle wrote:
> The following patch should fix the Tru64 bootstrap failure caused
> by a miscompilation of the compiler itself. The original cause is
> a bad interaction between ivopts and VRP, which revealed that VRP's
> extract_range_from_unary_expr incorrectly handles NEGATE_EXPR of
> unsigned types.
Thanks. The VRP changes have proven amazingly good at exposing
latent bugs. I believe with the pending Ada issue we're up to
a half-dozen distinct latent bugs exposed simply by getting
better range information. Sigh.
> Currently -[0,+Inf] results in the incorrect range [0,1] as the
> default case assumes the bounds as the unary operation applied
> to the operand bounds.
I've never really liked that style of coding in VRP; it just
seems like we might be better off with a switch statement handling
the useful cases and a default case which drops to varying. That
style may not have helped identify this problem though.
>
> I actually tried generating [0,+Inf] using TYPE_MIN_VALUE and
> TYPE_MAX_VALUE for min and max respectively, but this triggered
> an enable checking assert that didn't like ranges being set to
> these specific values.
This is definitely worth investigating further (ignoring for the
moment the Ada issue with values being allowed outside these
ranges).
Even though we can see that [0, INF] is effectively the same as
varying for an unsigned type, the code in VRP will do a better
job with the [0, INF] range than it will with VR_VARYING.
> Committed to mainline as revision 111327. It'll take me a while
> to confirm whether this resolves the Tru64 bootstrap failure, but
> the new testcase (thanks to Andrew Pinskia) is no longer miscompiled
> on AMD64.
>
>
>
> 2006-02-20 Roger Sayle <roger@eyesopen.com>
>
> PR tree-optimization/26361
> * tree-vrp.c (extract_range_from_unary_expr): Handle NEGATE_EXPR
> of unsigned integer types.
>
> * gcc.dg/tree-ssa/vrp27.c: New test case.
Thanks a ton.
Sorry for the breakage (why is it that breakage always occurs before a
long weekend? :-)
jeff