In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/2efdfb1e6cf6ff62b97356abd74ba479aee48bc1?hp=1a7cb6482feeead144ca91eb5258ac811e6aa01e>

- Log -----------------------------------------------------------------
commit 2efdfb1e6cf6ff62b97356abd74ba479aee48bc1
Author: Tony Cook <t...@develop-help.com>
Date:   Thu Nov 19 10:04:25 2015 +1100

    [perl #126635] don't shortcut when SVf_IVisUV is set
    
    Most integers are small, so in most cases it won't be set.
    
    The other option would be to always clear it, but that increases the
    amount of inline code for a rare case.
-----------------------------------------------------------------------

Summary of changes:
 pp.h       |  4 ++--
 t/op/int.t | 14 +++++++++++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/pp.h b/pp.h
index 687b0ca..60fe9ee 100644
--- a/pp.h
+++ b/pp.h
@@ -377,7 +377,7 @@ Does not use C<TARG>.  See also C<L</XPUSHu>>, 
C<L</mPUSHu>> and C<L</PUSHu>>.
     STMT_START {                                                        \
         IV TARGi_iv = i;                                                \
         if (LIKELY(                                                     \
-              ((SvFLAGS(TARG) & (SVTYPEMASK|SVf_THINKFIRST)) == SVt_IV) \
+              ((SvFLAGS(TARG) & (SVTYPEMASK|SVf_THINKFIRST|SVf_IVisUV)) == 
SVt_IV) \
             & (do_taint ? !TAINT_get : 1)))                             \
         {                                                               \
             /* Cheap SvIOK_only().                                      \
@@ -399,7 +399,7 @@ Does not use C<TARG>.  See also C<L</XPUSHu>>, 
C<L</mPUSHu>> and C<L</PUSHu>>.
     STMT_START {                                                        \
         UV TARGu_uv = u;                                                \
         if (LIKELY(                                                     \
-              ((SvFLAGS(TARG) & (SVTYPEMASK|SVf_THINKFIRST)) == SVt_IV) \
+              ((SvFLAGS(TARG) & (SVTYPEMASK|SVf_THINKFIRST|SVf_IVisUV)) == 
SVt_IV) \
             & (do_taint ? !TAINT_get : 1)                               \
             & (TARGu_uv <= (UV)IV_MAX)))                                \
         {                                                               \
diff --git a/t/op/int.t b/t/op/int.t
index 9aad020..dda4908 100644
--- a/t/op/int.t
+++ b/t/op/int.t
@@ -4,9 +4,10 @@ BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
     require './test.pl';
+    require Config;
 }
 
-plan 15;
+plan 17;
 
 # compile time evaluation
 
@@ -71,3 +72,14 @@ cmp_ok($y, '==', 4745162525730, 'compile time division, 
result of about 42 bits'
 $y = 279964589018079;
 $y = int($y/59);
 cmp_ok($y, '==', 4745162525730, 'run time divison, result of about 42 bits');
+
+SKIP:
+{   # see #126635
+    my $large;
+    $large = eval "0xffff_ffff" if $Config::Config{ivsize} == 4;
+    $large = eval "0xffff_ffff_ffff_ffff" if $Config::Config{ivsize} == 8;
+    $large or skip "Unusual ivsize", 1;
+    for my $x ($large, -1) {
+        cmp_ok($x, "==", int($x), "check $x == int($x)");
+    }
+}

--
Perl5 Master Repository

Reply via email to