Bug#588118: perl: numeric overloading problem on ia64
Niko Tyni
ntyni at debian.org
Wed Aug 25 10:47:08 UTC 2010
What seems to be happening is an integer -> float conversion
somewhere behind the curtains during overloading / numification.
This is reproducible on amd64 with
#!/usr/bin/perl -w
package Foo;
my $i = 0;
use overload '0+' => sub { (1 << 53) + ($i++) },
fallback => 1;
1;
package main;
print "1..2\n";
my $f1 = bless {}, 'Foo';
my $f2 = bless {}, 'Foo';
print ((($f1 == $f2) ? "not " : "") . "ok 1\n");
print (((0+$f1 == 0+$f2) ? "not " : "") . "ok 2\n");
__END__
which fails test 1 but not test 2.
Clearly the IV is coerced into an NV in the first case, losing precision
(both types are 64 bits wide) and making the values compare as equal.
The special thing about ia64 is that its reference addresses are big
integers and not small ones.
This looks like a bug to me , but I suppose it could be argued to be
a feature. I'll file an upstream bug and see what they think. It does
happen with current bleadperl FWIW.
--
Niko Tyni ntyni at debian.org
More information about the pkg-perl-maintainers
mailing list