From: Rafael Garcia-Suarez Date: Sun, 20 Jul 2003 20:12:54 +0000 (+0000) Subject: The warning "Possible precedence problem on bitwise operator" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2b84528b3b38853e791751a3bd2b6b8990027ef2;p=p5sagit%2Fp5-mst-13.2.git The warning "Possible precedence problem on bitwise operator" was incorrectly produced with the bitwise-assignment operators. Fix it. (bug #23065 concerning 5.8.1 RC2) p4raw-id: //depot/perl@20171 --- diff --git a/op.c b/op.c index 1366976..bcf4fb6 100644 --- a/op.c +++ b/op.c @@ -4686,9 +4686,10 @@ Perl_ck_bitop(pTHX_ OP *o) (op) == OP_NE || (op) == OP_I_NE || \ (op) == OP_NCMP || (op) == OP_I_NCMP) o->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); - if (o->op_type == OP_BIT_OR - || o->op_type == OP_BIT_AND - || o->op_type == OP_BIT_XOR) + if (!(o->op_flags & OPf_STACKED) /* Not an assignment */ + && (o->op_type == OP_BIT_OR + || o->op_type == OP_BIT_AND + || o->op_type == OP_BIT_XOR)) { OP * left = cBINOPo->op_first; OP * right = left->op_sibling; diff --git a/t/lib/warnings/op b/t/lib/warnings/op index 58056a6..35779a9 100644 --- a/t/lib/warnings/op +++ b/t/lib/warnings/op @@ -909,6 +909,7 @@ $a = $b < $c & $d; $a = $b >= $c ^ $d; $a = $b <= $c | $d; $a = $b <=> $c & $d; +$a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn no warnings 'precedence'; $a = $b & $c == $d; $a = $b ^ $c != $d;