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

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

Thread Previous | Thread Next
From:
Jonathan Stowe
Date:
February 7, 2007 13:26
Subject:
Re: [PATCH #30145] - fix up some warnings (was Re: Future Perldevelopment)
Message ID:
1170883605.13427.5.camel@coriolanus.gellyfish.com
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 :-(

/J\

Thread Previous | Thread Next


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