char *lsave;
char *rsave;
- if (optype == OP_BIT_OR && sv == left && !SvOK(sv) && !SvGMAGICAL(sv))
- sv_setpvn(sv, "", 0); /* avoid undef warning on |= */
+ if (sv != left || (optype != OP_BIT_AND && !SvOK(sv) && !SvGMAGICAL(sv)))
+ sv_setpvn(sv, "", 0); /* avoid undef warning on |= and ^= */
lsave = lc = SvPV(left, leftlen);
rsave = rc = SvPV(right, rightlen);
len = leftlen < rightlen ? leftlen : rightlen;
dPOPTOPssrl;
if (SvNIOKp(left) || SvNIOKp(right)) {
if (op->op_private & HINT_INTEGER) {
- IBW value = SvIV(left) ^ SvIV(right);
+ IBW value = (USE_LEFT(left) ? SvIV(left) : 0) ^ SvIV(right);
SETi( value );
}
else {
- UBW value = SvUV(left) ^ SvUV(right);
+ UBW value = (USE_LEFT(left) ? SvUV(left) : 0) ^ SvUV(right);
SETu( value );
}
}
{ my $x; $x &= 1; ok 13, uninitialized; }
{ my $x; $x |= 1; ok 14, ! uninitialized; }
-{ my $x; $x ^= 1; ok 15, uninitialized; }
+{ my $x; $x ^= 1; ok 15, ! uninitialized; }
{ my $x; $x &&= 1; ok 16, ! uninitialized; }
{ my $x; $x ||= 1; ok 17, ! uninitialized; }
{ my $x; $x &= "x"; ok 20, uninitialized; }
{ my $x; $x |= "x"; ok 21, ! uninitialized; }
-{ my $x; $x ^= "x"; ok 22, uninitialized; }
+{ my $x; $x ^= "x"; ok 22, ! uninitialized; }
ok 23, $warn eq '';