Subject: | inconsistent behaviour for bitmask scalars, between perl versions |
Date: | Wed, 19 Sep 2007 10:33:29 +0100 |
To: | bug-Readonly [...] rt.cpan.org |
From: | "Mark Morgan" <makk384 [...] gmail.com> |
Good day,
I've run into the following bug with Readonly; on some perl 5.8.5
systems that I'm using, the following code produces unexpected
behaviour (pared down to the minimum amount of code that causes the
issue):
====
#!/usr/bin/perl -l
use strict;
use warnings;
use Readonly;
Readonly my $t => 2 ** 3;
Readonly my $u => 2 ** 4;
print $t | $u;
print $t | $u
====
Under perl 5.8.8, I get the expected result from the above of:
24
24
However, under perl 5.8.5, I get the following returned:
96
24
The first invocation is always returning the same invalid value, after
which all subsequent invocation return the expected value.
Both of the above were run under the same hardware and OS (linux
2.6.19-1.2911.fc6, i386). The only differences is that the top result
was run under perl 5.8.8, whereas the second was on the same box
running under a chroot environment, and using perl 5.8.5.
I've been able to duplicate this behaviour on other 5.8.5 boxes (linux
2.6.9-55.EL, x86_64).
Mark.
PS: I've also running the above on a freebsd box (FreeBSD 4.8-RELEASE
#0 on i386), and this is experiencing the exact same erroneous
behaviour as above.