From: Nicholas Clark Date: Thu, 12 Apr 2007 15:51:58 +0000 (+0000) Subject: Change 18797 (Patch for [perl #9402], known also as "glibc _moddi3 bug X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=befad5d1180ef6841306dc0157ceec55281184c9;p=p5sagit%2Fp5-mst-13.2.git Change 18797 (Patch for [perl #9402], known also as "glibc _moddi3 bug with negative quads", or also as RedHat bug #65612.) was a bit brute force. In reality, we don't need to have an auto-detecting pp_i_modulo unless we're compiled with 64 bit IVs and on glibc. p4raw-id: //depot/perl@30931 --- diff --git a/pp.c b/pp.c index 8d53497..3df0209 100644 --- a/pp.c +++ b/pp.c @@ -2566,8 +2566,12 @@ PP(pp_i_divide) } } +#if defined(__GLIBC__) && IVSIZE == 8 STATIC PP(pp_i_modulo_0) +#else +PP(pp_i_modulo) +#endif { /* This is the vanilla old i_modulo. */ dVAR; dSP; dATARGET; tryAMAGICbin(modulo,opASSIGN); @@ -2587,6 +2591,7 @@ PP(pp_i_modulo_0) #if defined(__GLIBC__) && IVSIZE == 8 STATIC PP(pp_i_modulo_1) + { /* This is the i_modulo with the workaround for the _moddi3 bug * in (at least) glibc 2.2.5 (the PERL_ABS() the workaround). @@ -2604,7 +2609,6 @@ PP(pp_i_modulo_1) RETURN; } } -#endif PP(pp_i_modulo) { @@ -2624,7 +2628,6 @@ PP(pp_i_modulo) * opcode dispatch table if that is the case, remembering to * also apply the workaround so that this first round works * right, too. See [perl #9402] for more information. */ -#if defined(__GLIBC__) && IVSIZE == 8 { IV l = 3; IV r = -10; @@ -2640,7 +2643,6 @@ PP(pp_i_modulo) right = PERL_ABS(right); } } -#endif /* avoid FPE_INTOVF on some platforms when left is IV_MIN */ if (right == -1) SETi( 0 ); @@ -2649,6 +2651,7 @@ PP(pp_i_modulo) RETURN; } } +#endif PP(pp_i_add) {