In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/76734a3218e712760695898e424c2369ccdd49c6?hp=ffd2521e4c1de43a59187823fbf6e3aedeab5433>
- Log ----------------------------------------------------------------- commit 76734a3218e712760695898e424c2369ccdd49c6 Author: Father Chrysostomos <[email protected]> Date: Fri May 20 21:55:40 2016 -0700 [perl #128204] Fix crash with @a &.= etc. The new bitwise operators in their assignment forms were not correctly catching things like arrays on the lhs at compile time. At run time, they would either crash or croak with âCanât coerce ARRAY...â. This commit puts in the correct compile-time check, simply by flagging these as scalar modifiers. M op.c M t/lib/croak/op commit 118a40c4aa59af9330f4c37e86423a8b7c0d301c Author: Father Chrysostomos <[email protected]> Date: Fri May 20 20:32:48 2016 -0700 Another op description correction: & -> &. The string bitwise ops have dots in them, which should be included in the op descriptions. M opcode.h M regen/opcodes commit 5cb51e4d385f1a78e57460db8c624392985b7678 Author: Father Chrysostomos <[email protected]> Date: Fri May 20 20:24:50 2016 -0700 Correct âbitiwseâ in two op descriptions Oops! M opcode.h M regen/opcodes ----------------------------------------------------------------------- Summary of changes: op.c | 6 ++++++ opcode.h | 8 ++++---- regen/opcodes | 8 ++++---- t/lib/croak/op | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/op.c b/op.c index c921c15..619c6e3 100644 --- a/op.c +++ b/op.c @@ -3229,6 +3229,12 @@ S_scalar_mod_type(const OP *o, I32 type) case OP_BIT_AND: case OP_BIT_XOR: case OP_BIT_OR: + case OP_NBIT_AND: + case OP_NBIT_XOR: + case OP_NBIT_OR: + case OP_SBIT_AND: + case OP_SBIT_XOR: + case OP_SBIT_OR: case OP_CONCAT: case OP_SUBST: case OP_TRANS: diff --git a/opcode.h b/opcode.h index e4fc3ec..0aaefb6 100644 --- a/opcode.h +++ b/opcode.h @@ -643,12 +643,12 @@ EXTCONST char* const PL_op_desc[] = { "bitwise and (&)", "bitwise xor (^)", "bitwise or (|)", - "numeric bitiwse and (&)", + "numeric bitwise and (&)", "numeric bitwise xor (^)", "numeric bitwise or (|)", - "string bitiwse and (&)", - "string bitwise xor (^)", - "string bitwise or (|)", + "string bitwise and (&.)", + "string bitwise xor (^.)", + "string bitwise or (|.)", "negation (-)", "integer negation (-)", "not", diff --git a/regen/opcodes b/regen/opcodes index 893deb0..b70ff92 100644 --- a/regen/opcodes +++ b/regen/opcodes @@ -165,12 +165,12 @@ scmp string comparison (cmp) ck_null ifst2 S S bit_and bitwise and (&) ck_bitop fst2 S S| bit_xor bitwise xor (^) ck_bitop fst2 S S| bit_or bitwise or (|) ck_bitop fst2 S S| -nbit_and numeric bitiwse and (&) ck_bitop fsT2 S S| +nbit_and numeric bitwise and (&) ck_bitop fsT2 S S| nbit_xor numeric bitwise xor (^) ck_bitop fsT2 S S| nbit_or numeric bitwise or (|) ck_bitop fsT2 S S| -sbit_and string bitiwse and (&) ck_bitop fst2 S S| -sbit_xor string bitwise xor (^) ck_bitop fst2 S S| -sbit_or string bitwise or (|) ck_bitop fst2 S S| +sbit_and string bitwise and (&.) ck_bitop fst2 S S| +sbit_xor string bitwise xor (^.) ck_bitop fst2 S S| +sbit_or string bitwise or (|.) ck_bitop fst2 S S| negate negation (-) ck_null Ifst1 S i_negate integer negation (-) ck_null ifst1 S diff --git a/t/lib/croak/op b/t/lib/croak/op index 6e19ff8..a243a1f 100644 --- a/t/lib/croak/op +++ b/t/lib/croak/op @@ -65,6 +65,54 @@ my main $f; EXPECT No such class field "c" in variable $f of type main at - line 3. ######## +# NAME Num-specific &= on @array +use feature 'bitwise'; +@a &= 1; +EXPECT +The bitwise feature is experimental at - line 2. +Can't modify array dereference in numeric bitwise and (&) at - line 2, near "1;" +Execution of - aborted due to compilation errors. +######## +# NAME Num-specific |= on @array +use feature 'bitwise'; +@a |= 1; +EXPECT +The bitwise feature is experimental at - line 2. +Can't modify array dereference in numeric bitwise or (|) at - line 2, near "1;" +Execution of - aborted due to compilation errors. +######## +# NAME Num-specific ^= on @array +use feature 'bitwise'; +@a ^= 1; +EXPECT +The bitwise feature is experimental at - line 2. +Can't modify array dereference in numeric bitwise xor (^) at - line 2, near "1;" +Execution of - aborted due to compilation errors. +######## +# NAME &.= on @array +use feature 'bitwise'; +@a &.= 1; +EXPECT +The bitwise feature is experimental at - line 2. +Can't modify array dereference in string bitwise and (&.) at - line 2, near "1;" +Execution of - aborted due to compilation errors. +######## +# NAME |.= on @array +use feature 'bitwise'; +@a |.= 1; +EXPECT +The bitwise feature is experimental at - line 2. +Can't modify array dereference in string bitwise or (|.) at - line 2, near "1;" +Execution of - aborted due to compilation errors. +######## +# NAME ^.= on @array +use feature 'bitwise'; +@a ^.= 1; +EXPECT +The bitwise feature is experimental at - line 2. +Can't modify array dereference in string bitwise xor (^.) at - line 2, near "1;" +Execution of - aborted due to compilation errors. +######## # NAME Can't declare conditional my($a?$b:$c) EXPECT -- Perl5 Master Repository
