Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No subject provided #492

Closed
p5pRT opened this issue Sep 8, 1999 · 3 comments
Closed

No subject provided #492

p5pRT opened this issue Sep 8, 1999 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 8, 1999

Migrated from rt.perl.org#1334 (status was 'resolved')

Searchable as RT1334$

@p5pRT
Copy link
Author

p5pRT commented Sep 8, 1999

From mostow@il.ibm.com

The test program below, when run for Perl version 5.00403,
warns​:
Use of uninitialized value at /opt/local/lib/perl5/Math/BigInt.pm line 174.

My test program which uses BigInt addition initializes its variables.
Therefore, I think there is a bug in the BigInt package.
BTW, the warnings occur only when adding certain pairs of numbers.

#!/usr/local/bin/perl5 -w
use strict;

print "\tBigInt calculations for Perl version $]\n\n";
print "In at least some versions of Perl5, including 5.00403,
there are warning messages about
'use of uninitialized value' in
file perl5/Math/BigInt.pm, even though the variables in this calling
program are all initialized.
The correct answer is given despite the warnings.\n\n";

package BigIntBug;

use Math​::BigInt;

my $a = '134720';
my $b = '65294';
my $aa = Math​::BigInt->new($a);
my $bb = Math​::BigInt->new($b);
print "Hello 1\n";
my $c = $aa + $bb;
print "Hello 2\n";
my $d = Math​::BigInt->new($aa + $bb);
print "Used BigInt's to compute $aa + $bb = $c\n\n";

Perl Info


Site configuration information for perl 5.00403:

Configured by root at Tue Sep 23 17:19:00 IST 1997.

Summary of my perl5 (5.0 patchlevel 4 subversion 3) configuration:
  Platform:
    osname=aix, osvers=4.1.4.0, archname=aix
    uname='aix dsmsrv1 1 4 000019208900 '
    hint=previous, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='/opt/local/bin/gcc', optimize='-O', gccversion=2.7.2.2
    cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-I/usr/local/include -I/opt/local/include'
    ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-I/usr/local/include -I/opt/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=1, d_casti32=define, d_castneg=undef
    intsize=4, alignbytes=8, usemymalloc=n, randbits=15
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-ldbm -lld -lm -lc -lbsd -lPW
    libc=/lib/libc.a, so=a
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Xlinker
-bE:perl.exp'
    cccdlflags='-fpic', lddlflags='-H512 -T512 -bhalt:4 -bM:SRE
-bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -b noentry -lc -L/usr/local/lib
-L/opt/local/lib'



@INC for perl 5.00403:
     /opt/local/lib/perl5/aix/5.00403
     /opt/local/lib/perl5
     /opt/local/lib/perl5/site_perl/aix
     /opt/local/lib/perl5/site_perl
     .


Environment for perl 5.00403:
    HOME=/afs/haifa/home/mostow
    LANG=C
    LC__FASTMSG=true
    LD_LIBRARY_PATH=/tl/TCL_TK/lib
    LOGDIR (unset)



@p5pRT
Copy link
Author

p5pRT commented Sep 8, 1999

From [Unknown Contact. See original ticket]

On Wed, 08 Sep 1999 at 09​:37​:04 +0300, mostow@​il.ibm.com wrote​:

Use of uninitialized value at /opt/local/lib/perl5/Math/BigInt.pm line 174.

My test program which uses BigInt addition initializes its variables.
Therefore, I think there is a bug in the BigInt package.
BTW, the warnings occur only when adding certain pairs of numbers.

Thank you for your bug report. The warnings have been silenced in the
latest development versions of Perl (currently 5.00561).

Unfortunately, The new BigInt has a number of improvements and makes use
of overloaded constants, a new feature of Perl, so can't be used in its
entirety with your version of perl. Below are *SOME SELECTED* diffs to
show the bug fixes applied.

Ian

Inline Patch
--- ../perl5.004_04/lib/Math/BigInt.pm	Sun Apr 13 01:37:09 1997
+++ lib/Math/BigInt.pm	Tue Jul 20 18:18:00 1999
@@ -172,5 +184,5 @@
     for $x (@x) {
 	last unless @y || $car;
-	$x -= 1e5 if $car = (($x += shift(@y) + $car) >= 1e5) ? 1 : 0;
+	$x -= 1e5 if $car = (($x += (@y ? shift(@y) : 0) + $car) >= 1e5) ? 1 : 0;
     }
     for $y (@y) {
@@ -186,6 +198,6 @@
     $bar = 0;
     for $sx (@sx) {
-	last unless @y || $bar;
-	$sx += 1e5 if $bar = (($sx -= shift(@sy) + $bar) < 0);
+	last unless @sy || $bar;
+	$sx += 1e5 if $bar = (($sx -= (@sy ? shift(@sy) : 0) + $bar) < 0);
     }
     @sx;
@@ -254,6 +266,8 @@
     }
     @q = (); ($v2,$v1) = @y[-2,-1];
+    $v2 = 0 unless $v2;
     while ($#x > $#y) {
 	($u2,$u1,$u0) = @x[-3..-1];
+	$u2 = 0 unless $u2;
 	$q = (($u0 == $v1) ? 99999 : int(($u0*1e5+$u1)/$v1));
 	--$q while ($v2*$q > ($u0*1e5+$u1-$q*$v1)*1e5+$u2);

@p5pRT
Copy link
Author

p5pRT commented Sep 8, 1999

From [Unknown Contact. See original ticket]

Dear Ian,

That was fast! Thanks for your speedy reply about BigInt problems.
I have simply turned off warnings in my code for the problematic section, so
I'll just wait
until the fixed version is eventually installed at my site.

  Best wishes,

  Mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant