[PATCH] Fix PR31703, a bug in the shift lim code I added

Richard Guenther richard.guenther@gmail.com
Thu Apr 26 22:20:00 GMT 2007


On 4/26/07, H. J. Lu <hjl@lucon.org> wrote:
> On Thu, Apr 26, 2007 at 06:08:25PM +0200, Richard Guenther wrote:
> > On Thu, 26 Apr 2007, H. J. Lu wrote:
> >
> > > On Thu, Apr 26, 2007 at 04:33:12PM +0200, Richard Guenther wrote:
> > > >
> > > > I forgot to consider the case we have a widened result.  The simple
> > > > fix is to always create a new lhs for storing the bittest result rather
> > > > than trying to re-use the old one.
> > > >
> > > > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.  I'll
> > > > apply after that finished.
> > > >
> > > > Richard.
> > > >
> > > > 2007-04-26  Richard Guenther  <rguenther@suse.de>
> > > >
> > > >   PR tree-optimization/31703
> > > >   * tree-ssa-loop-im.c (rewrite_bittest): Make sure to use
> > > >   the right type for the target of the bittest.
> > > >
> > > >   * gcc.c-torture/compile/pr31703.c: New testcase.
> > > >
> > >
> > > Can you make it a runtime testcase since gcc miscompiled it on
> > > 64bit host?
> >
> > I tried but failed to.
>
> But gcc.c-torture/compile/pr31703.c doesn't fail to compile even
> without your bug fix on Linux/i686. However, the testcase in

The gcc.c-torture/compile/pr31703.c fails for me on x86_64 with -m32
(without the patch).

> http://gcc.gnu.org/ml/gcc/2007-04/msg00878.html
>
> void test (long long mod, long long temp)
> {
>   while (1)
>     {
>       int leftmost = (mod >> 1) & 1;
>       mod = mod << 1;
>       if (leftmost)
>         mod = temp;
>     }
> }
>
> does fail without your patch.

Feel free to add this then (maybe you can construct a failing runtime
testcase from thath).

Richard.

>
>
> H.J.
>



More information about the Gcc-patches mailing list