This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sv_dec is supposed to go *down*, m'kay.
authorNicholas Clark <nick@ccl4.org>
Sat, 9 Jul 2005 15:44:17 +0000 (15:44 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 9 Jul 2005 15:44:17 +0000 (15:44 +0000)
p4raw-id: //depot/perl@25102

sv.c
t/op/inc.t

diff --git a/sv.c b/sv.c
index 268cb3a..99e456e 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -7067,7 +7067,7 @@ Perl_sv_dec(pTHX_ register SV *sv)
            }
            else {
                (void)SvIOK_only_UV(sv);
            }
            else {
                (void)SvIOK_only_UV(sv);
-               SvUV_set(sv, SvUVX(sv) + 1);
+               SvUV_set(sv, SvUVX(sv) - 1);
            }   
        } else {
            if (SvIVX(sv) == IV_MIN)
            }   
        } else {
            if (SvIVX(sv) == IV_MIN)
index 156ca92..5f05642 100755 (executable)
@@ -2,7 +2,7 @@
 
 # use strict;
 
 
 # use strict;
 
-print "1..30\n";
+print "1..32\n";
 
 my $test = 1;
 
 
 my $test = 1;
 
@@ -176,3 +176,12 @@ check_same (\%orig, \%postdec);
     ok($p == -1, $p);
     ok($@ eq '', $@);
 }
     ok($p == -1, $p);
     ok($@ eq '', $@);
 }
+
+$a = 2147483648;
+$c=--$a;
+ok ($a == 2147483647, $a);
+
+
+$a = 2147483648;
+$c=$a--;
+ok ($a == 2147483647, $a);