From: Nicholas Clark Date: Tue, 3 Jan 2006 19:38:24 +0000 (+0000) Subject: If NV_ZERO_IS_ALLBITS_ZERO is not true, then it's important to inialise X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e5ce394ccbcb3ef5a450374c9a26bafe8a88dfa7;p=p5sagit%2Fp5-mst-13.2.git If NV_ZERO_IS_ALLBITS_ZERO is not true, then it's important to inialise the NV only if the new body has an NV. (D'oh!) p4raw-id: //depot/perl@26623 --- diff --git a/sv.c b/sv.c index d32bd99..022f936 100644 --- a/sv.c +++ b/sv.c @@ -1124,8 +1124,11 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 new_type) #ifndef NV_ZERO_IS_ALLBITS_ZERO /* If NV 0.0 is stores as all bits 0 then Zero() already creates a - * correct 0.0 for us. */ - if (old_type_details->zero_nv) + * correct 0.0 for us. Otherwise, if the old body didn't have an + * NV slot, but the new one does, then we need to initialise the + * freshly created NV slot with whatever the correct bit pattern is + * for 0.0 */ + if (old_type_details->zero_nv && !new_type_details->zero_nv) SvNV_set(sv, 0); #endif