This is just part of #87708.
This fixes the + operator outside of any ‘use integer’ when the same
tied scalar is used for both operands and returns two different val-
ues. Before this commit, get-magic would be called only once and the
same value used. In 5.12.x it worked.
svl = TOPm1s;
useleft = USE_LEFT(svl);
+ if(useleft && svr == svl) {
+ /* Print the uninitialized warning now, so it includes the vari-
+ able name. */
+ if (!SvOK(svl)) report_uninit(svl), useleft = 0;
+ /* Non-magical sv_mortalcopy */
+ svl = sv_newmortal();
+ sv_setsv_flags(svl, svr, 0);
+ SvGETMAGIC(svr);
+ }
+
#ifdef PERL_PRESERVE_IVUV
/* We must see if we can perform the addition with integers if possible,
as the integer code detects overflow while the NV code doesn't.
Use of uninitialized value $m1 in subtraction (-) at - line 20.
########
use warnings 'uninitialized';
+sub TIESCALAR{bless[]}
+sub FETCH { undef }
+
+tie my $m1, "";
+my $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 warnings 'uninitialized';
my ($m1, $v);
our ($g1);
{
local $TODO = $todo ;
bin_test '==', 1, 2, "";
- bin_test '+' , 1, 2, 3;
}
+bin_test '+' , 1, 2, 3;
bin_int_test '*' , 2, 3, 6;
bin_int_test '/' , 10, 2, 5;
bin_int_test '%' , 11, 2, 1;