develooper Front page | perl.perl5.porters | Postings from February 2007

Re: [PATCH #30145] - fix up some warnings (was Re: Future Perl development)

From:
demerphq
Date:
February 7, 2007 14:05
Subject:
Re: [PATCH #30145] - fix up some warnings (was Re: Future Perl development)
Message ID:
9b18b3110702071405o1d7053ddrad970f68db0f3ac0@mail.gmail.com
On 2/7/07, Jonathan Stowe <jns@gellyfish.com> wrote:
> On Wed, 2007-02-07 at 21:53 +0100, demerphq wrote:
> > On 2/7/07, Jonathan Stowe <jns@gellyfish.com> wrote:
> > > On Wed, 2007-02-07 at 10:11 +0000, hv@crypt.org wrote:
> > > > Nicholas Clark <nick@ccl4.org> wrote:
> > > > :would you all be so kind as to download this snapshot [...]
> > > >
> > > > All tests successful.
> > > > u=4.72  s=1.25  cu=259.65  cs=26.95  scripts=959  tests=122092
> > > > make[2]: Leaving directory `/src/package/lang/perl/perl-30145'
> > > > make[1]: Leaving directory `/src/package/lang/perl/perl-30145'
> > > >
> > > > I haven't built maint for a while, and I notice a number of compile-time
> > > > warnings I don't recognise. (This may also be due to upgrading to gcc 4.1.x.)
> > >
> > > This fixes some of the ones I'm seeing.
> > [...]
> > > diff -ru perl-30145/mg.c perl-30145.new/mg.c
> > > --- perl-30145/mg.c     2007-02-05 22:26:27.000000000 +0000
> > > +++ perl-30145.new/mg.c 2007-02-07 13:59:33.000000000 +0000
> > > @@ -503,8 +503,8 @@
> > >                 I32 paren = rx->lastparen;
> > >
> > >                 /* return the last filled */
> > > -               while ( paren >= 0 &&
> > > -                   rx->startp[paren] == -1 || rx->endp[paren] == -1)
> > > +               while ( (paren >= 0 &&
> > > +                   rx->startp[paren] == -1) || rx->endp[paren] == -1)
> > >                 paren--;
> > >                 return (U32)paren;
> > >             }
> >
> > Im thinking that probably is wrong. Doesn't it mean that paren can go
> > negative in the loop?
> >
> > And checking, in blead (not sure from what patch) we now have:
> >
> >               while ( paren >= 0
> >                       && (rx->startp[paren] == -1 || rx->endp[paren] == -1) )
> >
>
> Hmm, I was wondering about that while I was doing it, I was led by the
> way that the compiler appeared to be interpreting without the
> parentheses as was suggested in the warning. The slightly worrying thing
> is that it appears to pass the tests both ways :-(

Well a test was added when the routine was recoded in

http://public.activestate.com/cgi-bin/perlbrowse/p/29312

But since the precedence issue wasnt fixed until

http://public.activestate.com/cgi-bin/perlbrowse/p/29325

I bet that test doesnt find the bug anyway. But as its fixed its sorta
irrelevent except perhaps as an excuse to use Daves shiny new
perlbrowse. :-)

Cheers,
Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About