summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-04-07 11:44:15 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-04-07 12:11:33 -0700
commit7d779b236fc2cb0c2dbe324bda777c76494a71a5 (patch)
treeb266452ad87b1699b90ab70c684eb59afdbf4ded /t
parenta778d1f5c1a446254887ec8addb0044ba74ea05a (diff)
downloadperl-7d779b236fc2cb0c2dbe324bda777c76494a71a5.tar.gz
[perl #87708] $tied == $tied
This is only part of #87708. This fixes the + operator outside of any ‘use integer’ scope when the same tied scalar is used for both operands and returns two different values. Before this commit, get-magic would be called only once and the same value used. In 5.12.x it just worked. I tried modifying pp_eq throughout to take this case into account, but it made the most common cases slightly slower, presumably because of the extra checks. So this follows the same temp sv method that I used for pp_add (in 4c3ac4b and 837c879), which, though slowing down this edge cases due to the extra allocation, leaves the most common cases just as fast. (And, in case my benchmarks were unreliably [not unlikely], this method is also safer, as it has less chance of getting different code paths wrong.)
Diffstat (limited to 't')
-rw-r--r--t/lib/warnings/9uninit11
-rw-r--r--t/op/tie_fetch_count.t5
2 files changed, 9 insertions, 7 deletions
diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit
index 1dcee790e2..4472db400a 100644
--- a/t/lib/warnings/9uninit
+++ b/t/lib/warnings/9uninit
@@ -693,12 +693,17 @@ sub TIESCALAR{bless[]}
sub FETCH { undef }
tie my $m1, "";
-my $v = $m1 + $m1;
+my $v;
+$v = $m1 + $m1;
+$v = $m1 - $m1;
no warnings;
$v = $m1 + $m1;
+$v = $m1 - $m1;
EXPECT
-Use of uninitialized value $m1 in addition (+) at - line 6.
-Use of uninitialized value $m1 in addition (+) at - line 6.
+Use of uninitialized value $m1 in addition (+) at - line 7.
+Use of uninitialized value $m1 in addition (+) at - line 7.
+Use of uninitialized value $m1 in subtraction (-) at - line 8.
+Use of uninitialized value $m1 in subtraction (-) at - line 8.
########
use warnings 'uninitialized';
my ($m1, $v);
diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t
index be339cdc3f..df1c0feba0 100644
--- a/t/op/tie_fetch_count.t
+++ b/t/op/tie_fetch_count.t
@@ -225,10 +225,7 @@ my $todo = 'bug #87708';
bin_test '|' , 1, 2, 3;
}
bin_test '.' , 1, 2, 12;
-{
- local $TODO = $todo ;
- bin_test '==', 1, 2, "";
-}
+bin_test '==', 1, 2, "";
bin_test '+' , 1, 2, 3;
bin_int_test '*' , 2, 3, 6;
bin_int_test '/' , 10, 2, 5;