summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-10-23 20:28:56 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-10-23 20:28:56 +0000
commit4bb9f687ed0930c988c412c4c28bd2a535612894 (patch)
tree523f8d14abb622d7199b86effa1626929d0b38d9 /op.c
parent6f9bb7fd34a6047f919bd09bd87e990f064e148c (diff)
downloadperl-4bb9f687ed0930c988c412c4c28bd2a535612894.tar.gz
fix accidental C modulo semantics on integer-valued operations
(e.g. caused C<length("abc") % -10> to return 3 rather than -7) p4raw-id: //depot/perl@4428
Diffstat (limited to 'op.c')
-rw-r--r--op.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/op.c b/op.c
index f38b26cf15..7fae9f75ca 100644
--- a/op.c
+++ b/op.c
@@ -2112,8 +2112,12 @@ Perl_fold_constants(pTHX_ register OP *o)
return o;
if (!(PL_hints & HINT_INTEGER)) {
- if (type == OP_DIVIDE || !(o->op_flags & OPf_KIDS))
+ if (type == OP_MODULO
+ || type == OP_DIVIDE
+ || !(o->op_flags & OPf_KIDS))
+ {
return o;
+ }
for (curop = ((UNOP*)o)->op_first; curop; curop = curop->op_sibling) {
if (curop->op_type == OP_CONST) {