PATCH RFC: Use explicit representation of infinity in VRP

Ian Lance Taylor
Sun Mar 11 16:48:00 GMT 2007

"Richard Guenther" <> writes:

> On 02 Mar 2007 12:09:43 -0800, Ian Lance Taylor <> wrote:
> > Ian Lance Taylor <> writes:
> >
> > > This patch is a lengthy prelude to adding full support for
> > > -fstrict-overflow and -Wstrict-overflow to tree-vrp.c.  It changes VRP
> > > to use an explicit representation of signed infinity when there is a
> > > signed overflow.
> >
> > Committed as follows.
> This patch causes optimization regressions because it preserves "overflow"
> even if -fstrict-overflow is in effect or -Wstrict-overflow is not in effect.
> See PR31130.  I believe needs_overflow_infinity () should return false
> for -fstrict-overflow.

That would not be the right fix.  It would cause -Wstrict-overflow to
become ineffective for VRP, which would put us right back where we
were when I started the whole series of patches: user code would act
in unexpected ways with no warning.  And simply adding
-Wstrict-overflow should not, of course, change code generation.

I know that some people are uneasy with the whole idea of this series
of patches.  But the fact is, real users were prepared to turn on
-fwrapv for all code which uses autoconf, which is a good fraction of
uses of gcc.  I think that my patch does considerably less harm than
that.  I am always open to other suggestions, and I have asked for
them consistently during this series of patches.

I can actually produce a number of test cases in which VRP now acts
differently but the optimization in question happens anyhow.  It would
be more interesting to find cases where the optimization no longer

That said, for this test case, we may be able to turn NEGATE_EXPR of
[-INF, X] into [-X, INF] rather than [-X, INF(OVF)].


More information about the Gcc-patches mailing list