summaryrefslogtreecommitdiff
path: root/pp_sort.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp_sort.c')
-rw-r--r--pp_sort.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/pp_sort.c b/pp_sort.c
index fafa00acf2..0ee42dcf38 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1874,6 +1874,14 @@ S_sv_ncmp(pTHX_ SV *const a, SV *const b)
PERL_ARGS_ASSERT_SV_NCMP;
+#if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan)
+ if (Perl_isnan(right) || Perl_isnan(left)) {
+#else
+ if (nv1 != nv1 || nv2 != nv2) {
+#endif
+ if (ckWARN(WARN_UNINITIALIZED)) report_uninit(NULL);
+ return 0;
+ }
return nv1 < nv2 ? -1 : nv1 > nv2 ? 1 : 0;
}