-
Notifications
You must be signed in to change notification settings - Fork 558
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
Bleadperl v5.23.4-97-gedba15b breaks ZEFRAM/Data-Integer-0.005.tar.gz #15049
Comments
From @andkbisect commit edba15b make SETi/u/n, (X)PUSHi/u/n more efficient cpantesters http://www.cpantesters.org/cpan/report/e49fea62-884b-11e5-b601-b72fa9884ca8 perl -V Summary of my perl5 (revision 5 version 23 subversion 5) configuration: Characteristics of this binary (from libperl): |
From @tonycozOn Fri Nov 13 15:34:29 2015, andreas.koenig.7os6VVqR@franz.ak.mind.de wrote:
The new macros aren't clearing SVf_IVisUV, so when a targ that was used for a UV (setting the flag) was then used for a negative IV range number, it would be treated as a large UV rather than a small IV. Patch attached. Tony |
From @tonycoz0001-perl-126635-clear-SVf_IVisUV-when-saving-a-plain-IV.patchFrom 9ebffc03436ce7849d637c54ab143e5d4668764e Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Wed, 18 Nov 2015 17:22:50 +1100
Subject: [perl 126635] clear SVf_IVisUV when saving a plain IV
---
pp.h | 2 ++
t/op/int.t | 14 +++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/pp.h b/pp.h
index 945d1e5..985b04b 100644
--- a/pp.h
+++ b/pp.h
@@ -385,6 +385,7 @@ Does not use C<TARG>. See also C<L</XPUSHu>>, C<L</mPUSHu>> and C<L</PUSHu>>.
* clear can't be set, because we're SVt_IV */ \
assert(!(SvFLAGS(TARG) & \
(SVf_OOK|SVf_UTF8|(SVf_OK & ~(SVf_IOK|SVp_IOK))))); \
+ SvFLAGS(TARG) &= ~SVf_IVisUV; \
SvFLAGS(TARG) |= (SVf_IOK|SVp_IOK); \
/* SvIV_set() where sv_any points to head */ \
TARG->sv_u.svu_iv = TARGi_iv; \
@@ -408,6 +409,7 @@ Does not use C<TARG>. See also C<L</XPUSHu>>, C<L</mPUSHu>> and C<L</PUSHu>>.
* clear can't be set, because we're SVt_IV */ \
assert(!(SvFLAGS(TARG) & \
(SVf_OOK|SVf_UTF8|(SVf_OK & ~(SVf_IOK|SVp_IOK))))); \
+ SvFLAGS(TARG) &= ~SVf_IVisUV; \
SvFLAGS(TARG) |= (SVf_IOK|SVp_IOK); \
/* SvIV_set() where sv_any points to head */ \
TARG->sv_u.svu_iv = TARGu_uv; \
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)");
+ }
+}
--
2.1.4
|
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Tue, Nov 17, 2015 at 10:25:48PM -0800, Tony Cook via RT wrote:
Looks good to me; thanks. -- |
From @tonycozOn Wed Nov 18 08:56:10 2015, davem wrote:
I was thinking about it afterwards, and wondered if the attached was closer to the spirit of the original change. I'm curious as to why the TARG[iun] macros use & instead of && for the conditional? Tony |
From @tonycoz0001-perl-126635-don-t-shortcut-when-SVf_IVisUV-is-set.patchFrom cd4c2c9944c5927af983c32cd6e78099348e58d3 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 19 Nov 2015 10:04:25 +1100
Subject: [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.
---
pp.h | 4 ++--
t/op/int.t | 14 +++++++++++++-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/pp.h b/pp.h
index 945d1e5..b92230a 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)");
+ }
+}
--
2.1.4
|
From @iabynOn Wed, Nov 18, 2015 at 03:08:15PM -0800, Tony Cook via RT wrote:
Yes, that looks better.
Its to avoid doing an extra conditionals with the risk of branch -- |
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for submitting this report. You have helped make Perl better. Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0 |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#126635 (status was 'resolved')
Searchable as RT126635$
The text was updated successfully, but these errors were encountered: