New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C<use integer; $x += 1> gives uninitialized warning #2764
Comments
From @ysthCreated by @ysth+= and -= give an uninitialized warning only when under use integer: [D:\home\sthoenna]perl -we "$x += 1; print $x" --, ++, +=, -=, |=, and ^= are supposed to not give this warning. Patch (to 7348): Inline Patch--- pp.c.orig Sun Oct 15 19:21:44 2000
+++ pp.c Thu Oct 26 11:23:48 2000
@@ -1566,7 +1566,7 @@
{
djSP; dATARGET; tryAMAGICbin(add,opASSIGN);
{
- dPOPTOPiirl;
+ dPOPTOPiirl_ul;
SETi( left + right );
RETURN;
}
@@ -1576,7 +1576,7 @@
{
djSP; dATARGET; tryAMAGICbin(subtr,opASSIGN);
{
- dPOPTOPiirl;
+ dPOPTOPiirl_ul;
SETi( left - right );
RETURN;
}
--- t/op/assignwarn.t.orig Thu Sep 14 19:55:14 2000
+++ t/op/assignwarn.t Thu Oct 26 13:53:40 2000
@@ -21,7 +21,7 @@
sub uninitialized { $warn =~ s/Use of uninitialized value[^\n]+\n//s; }
-print "1..23\n";
+print "1..32\n";
{ my $x; $x ++; ok 1, ! uninitialized; }
{ my $x; $x --; ok 2, ! uninitialized; }
@@ -55,7 +55,19 @@
{ my $x; $x |= "x"; ok 21, ! uninitialized; }
{ my $x; $x ^= "x"; ok 22, ! uninitialized; }
-ok 23, $warn eq '';
+{ use integer; my $x; $x += 1; ok 23, ! uninitialized; }
+{ use integer; my $x; $x -= 1; ok 24, ! uninitialized; }
+
+{ use integer; my $x; $x *= 1; ok 25, uninitialized; }
+{ use integer; my $x; $x /= 1; ok 26, uninitialized; }
+{ use integer; my $x; $x %= 1; ok 27, uninitialized; }
+
+{ use integer; my $x; $x ++; ok 28, ! uninitialized; }
+{ use integer; my $x; $x --; ok 29, ! uninitialized; }
+{ use integer; my $x; ++ $x; ok 30, ! uninitialized; }
+{ use integer; my $x; -- $x; ok 31, ! uninitialized; }
+
+ok 32, $warn eq '';
# If we got any errors that we were not expecting, then print them
print map "#$_\n", split /\n/, $warn if length $warn; Perl Info
|
Migrated from rt.perl.org#4521 (status was 'resolved')
Searchable as RT4521$
The text was updated successfully, but these errors were encountered: