|
Dave Mitchell |
at Apr 1, 2004 at 10:36 pm
|
⇧ |
| |
On Thu, Apr 01, 2004 at 09:18:16PM +0200, Marcus Holland-Moritz wrote:This change ...
Change 22376 by
[email protected] on 2004/02/25 17:10:56
stop "const in void context" warning for a const in an
optimised-away boolean expresssion, eg 5 || print;
... introduces the following:
----Program----
1&&undef
----Output of .../pmkg5be/
[email protected]/bin/perl----
----EOF ($?='0')----
----Output of .../pyIn9WJ/
[email protected]/bin/perl----
Modification of a read-only value attempted at test.pl line 1.
----EOF ($?='65280')----
Mea cupla and all that. Fixed below.
--
"There's something wrong with our bloody ships today, Chatfield."
-- Admiral Beatty at the Battle of Jutland, 31st May 1916.
Change 22635 by
[email protected] on 2004/04/01 20:27:14
Fix change #22376. Only mark a const as short-circuited
if it's actually a const!
Affected files ...
... //depot/perl/op.c#622 edit
Differences ...
==== //depot/perl/op.c#622 (text) ====
@@ -3373,7 +3373,8 @@
(type == OP_DOR && !SvOK(((SVOP*)first)->op_sv))) {
op_free(first);
*firstp = Nullop;
- other->op_private |= OPpCONST_SHORTCIRCUIT;
+ if (other->op_type == OP_CONST)
+ other->op_private |= OPpCONST_SHORTCIRCUIT;
return other;
}
else {
@@ -3396,7 +3397,8 @@
op_free(other);
*otherp = Nullop;
- first->op_private |= OPpCONST_SHORTCIRCUIT;
+ if (first->op_type == OP_CONST)
+ first->op_private |= OPpCONST_SHORTCIRCUIT;
return first;
}
}