[patch] for PR 23361

Richard Guenther richard.guenther@gmail.com
Thu Feb 8 16:18:00 GMT 2007


On 2/8/07, Richard Guenther <richard.guenther@gmail.com> wrote:
> On 2/8/07, Richard Guenther <richard.guenther@gmail.com> wrote:
> > On 2/8/07, Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> wrote:
> > > Hello,
> > >
> > > one of the reasons for this PR is that we fail to fold expressions like
> > > a + 10 > MIN_INT + 2, that are always true (assuming that the
> > > arithmetics in the considered type does not overflow).  Such expressions
> > > are fairly often produced by number of iterations analysis.
> > > This patch implements such simplifications.
> > >
> > > Bootstrapped & regtested on i686 and x86_64.
> >
> > Hmm, this looks overly complicated.  But maybe I'm missing something
> > obvious - the
> > attached also works for your testcase, but I dind't yet bootstrap & test it.
>
> A quick check with PR23361 (now that gcc.gnu.org responds again) shows that
> my patch does not cause the loop in foo2 () to be removed:
>
> void foo2(int a, int b)
> { for(;a<b;a+=4); }
>
> (I didn't check yours, but there seems to be one condition missing
> from the testcase).
>
> We should definitely add the loop testcases to the testsuite if we
> check in a fix
> for this bug!

Doh, I missed

          else if (code2 == NE_EXPR
                   || code2 == GE_EXPR
   ^^^^
this line
                   || code2 == GT_EXPR)

in my patch.

Richard.



More information about the Gcc-patches mailing list