In perl.git, the branch smoke-me/pp_pow has been updated <http://perl5.git.perl.org/perl.git/commitdiff/f0b3d975dd7562389f7498a3215659ec011782ca?hp=65c512c3519b68852f64f5e1293cebadee892115>
- Log ----------------------------------------------------------------- commit f0b3d975dd7562389f7498a3215659ec011782ca Author: Nicholas Clark <[email protected]> Date: Tue Apr 17 11:32:09 2012 +0200 In pp_pow, remove calls to SvIV_please_nomg() on (not the) result. Commit 52a96ae66a5b0cd1 in Feb 2003 added logic to call SvIV_please(TOPs) for the places where pp_pow had integer inputs, but returned an NV. TOPs was used, because at the point of return, the result is in the top slot of the stack. Commit 800401ee2a8a5a67 in Oct 2007 inadvertently changed the TOPs to svr, as part of a larger (systematic) refactoring that needed to use local variables instead of stack positions to reference the input SVs, not realising that these two particular instances of TOPs were not referencing the right input operand. No tests failed. (The SvIV_please() was subsequently changed to *_nomg() as part of commit 6f1401dc2acd2a2b) Hence the code as-is is wrong. However, even changing these two back to TOPs to massage the result SV is unnecessary, as they will have no Perl-space effect. If the NV value is not in the range that integers preserve UVs, then the public IOK flag will not be set. If it is, that flag will be set, but all arithmetic operations *also* call SvIV_please_nomg() on their input, so the flag would be set there (instead). So remove the code, as it's not needed. ----------------------------------------------------------------------- Summary of changes: pp.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-) diff --git a/pp.c b/pp.c index ba3ac1f..cd558a5 100644 --- a/pp.c +++ b/pp.c @@ -1085,9 +1085,6 @@ PP(pp_postinc) PP(pp_pow) { dVAR; dSP; dATARGET; SV *svl, *svr; -#ifdef PERL_PRESERVE_IVUV - bool is_int = 0; -#endif tryAMAGICbin_MG(pow_amg, AMGf_assign|AMGf_numeric); svr = TOPs; svl = TOPm1s; @@ -1128,7 +1125,6 @@ PP(pp_pow) } } /* now we have integer ** positive integer. */ - is_int = 1; /* foo & (foo - 1) is zero only for a power of 2. */ if (!(baseuv & (baseuv - 1))) { @@ -1154,7 +1150,6 @@ PP(pp_pow) } SP--; SETn( result ); - SvIV_please_nomg(svr); RETURN; } else { register unsigned int highbit = 8 * sizeof(UV); @@ -1247,10 +1242,6 @@ PP(pp_pow) SETn( Perl_pow( left, right) ); #endif /* HAS_AIX_POWL_NEG_BASE_BUG */ -#ifdef PERL_PRESERVE_IVUV - if (is_int) - SvIV_please_nomg(svr); -#endif RETURN; } } -- Perl5 Master Repository
