summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-01-03 19:38:24 +0000
committerNicholas Clark <nick@ccl4.org>2006-01-03 19:38:24 +0000
commite5ce394ccbcb3ef5a450374c9a26bafe8a88dfa7 (patch)
tree2eeecd5b2861eda25db1850e014cd5e537cea245 /sv.c
parent3b7fbd4a8e0aec57c7898a1775b0a17a345883de (diff)
downloadperl-e5ce394ccbcb3ef5a450374c9a26bafe8a88dfa7.tar.gz
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
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index d32bd99c36..022f936ec8 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