From my slightly cargo-culty perspective on what's going on here, I think that bug looks like it - especially given that non-bitwise ops don't seem to show the weirdness, and since nor does putting the constant string in a variable before doing the &:
use Devel::Peek;
use strict;
no warnings "numeric";
sub xx {
my $arg = shift;
my $const = "";
print "(" . ($arg & $const) . ")\n";
}
xx("ff");
xx(7);
xx("ff");
This code gives:
SV = PV(0x100802558) at 0x1008474e0
REFCNT = 1
FLAGS = (PADMY,POK,pPOK)
PV = 0x1002074f0 "ff"\0
CUR = 2
LEN = 8
()
SV = PVIV(0x100803c58) at 0x1008474e0
REFCNT = 1
FLAGS = (PADMY,IOK,pIOK)
IV = 7
PV = 0x1002074f0 "ff"\0
CUR = 2
LEN = 8
(0)
SV = PVIV(0x100803c58) at 0x1008474e0
REFCNT = 1
FLAGS = (PADMY,POK,pPOK)
IV = 7
PV = 0x1002074f0 "ff"\0
CUR = 2
LEN = 8
()