develooper Front page | perl.perl5.porters | Postings from January 2001

RE: [PATCH: perl@8429] lib/tie-substrhash.t FAILED at test 11

Thread Previous | Thread Next
From:
Roca, Ignasi
Date:
January 17, 2001 06:51
Subject:
RE: [PATCH: perl@8429] lib/tie-substrhash.t FAILED at test 11
Message ID:
5930DC161690D2119667009027157547038C8B4A@madt009a.siemens.es
> On Wed, Jan 17, 2001 at 03:16:43PM +0100, Roca, Ignasi wrote:
> > There is a bug in pp_int() function that has a bad influence in the wrap
> > method of Tie::Substrhash
> > 
> > Try following perl-script:
> > 
> > $t0 = 279964589018079;
> > 
> > $t1 = int($t0 / 59);
> > print "int($t0/59)=$t1\n";
> > 
> > The result is 
> > int(279964589018079/59)=4745162525730.15
> >
> > As you can see result is not an integer.
> 
> Wow, there's definitely a bug in there, though I see it a little
> bit differently:
> 
> ./perl -le 'print int(279964589018079/59)'
> 
> Attempt to free unreferenced scalar.
> 
> mimosa being a Solaris/sparc box.
> 
> (Note that 279964589018079 is large enough to overflow 32 bits,
> so in the general case you really shouldn't assume that you get
> any accurate results from the division, though.)
> 
With ./perl -le 'print int(279964589018079/59)' in posix-bc I have also the
"Attempt to free unreferenced scalar" message.
But with the above script is runs, and with the patch the result is OK.

> > Following is a patch to correct the bug
> > ===============================================
> > --- pp.c.orig   Tue Jan  9 05:14:45 2001
> > +++ pp.c        Wed Jan 17 15:10:30 2001
> > @@ -2593,6 +2593,7 @@
> >                   (void)Perl_modf(tmp, &tmp);
> >                   value = (NV)tmp;
> >  #endif
> > +                 SETn(value);
> 
> Thanks, applied.
> 
> >               }
> >           }
> >           else {
> > ===============================================
> > 
> > -- Ignasi Roca
> 
> -- 
> $jhi++; # http://www.iki.fi/jhi/
>         # There is this special biologist word we use for 'stable'.
>         # It is 'dead'. -- Jack Cohen

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