Skip to content

Commit 7de9573

Browse files
authored
Don't verify exact NaN text for .debugDescription (#33391)
This specific check has never worked on all processors (because some FP HW mangles NaNs) and recent LLVM changes have broken it on the remaining platforms. Resolves SR-13354
1 parent 142aa5f commit 7de9573

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

test/stdlib/PrintFloat.swift.gyb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -442,21 +442,20 @@ fileprivate func expectNaN<T>(_ expected: String, _ object: T,
442442
message(),
443443
stackTrace: stackTrace.pushIf(showFrame, file: file, line: line))
444444

445-
// debugDescription prints full details about NaNs, which is tricky to test
446-
// because NaNs often get truncated: various implementations force all NaNs
447-
// quiet, discard payloads, or clear sign bits. In some cases, just passing a
448-
// NaN into a function (via an FP register) is enough to mangle the value.
449-
450-
#if arch(x86_64)
451-
// Verify the exact debugDescription value only on x86_64, where we
452-
// know the exact expected String:
445+
// debugDescription tries to print details about NaNs, which is tricky to test.
446+
447+
/*
448+
// We cannot reliably test the exact expected string, because various
449+
// implementations force all NaNs quiet, discard payloads, or clear sign bits.
450+
// In some cases, just passing a NaN into a function (via an FP register) is
451+
// enough to mangle the value.
453452
expectEqual(expected, object.debugDescription,
454453
message(),
455454
stackTrace: stackTrace.pushIf(showFrame, file: file, line: line))
456-
#endif
455+
*/
457456

458-
// On all platforms, we verify that the generated debugDescription text
459-
// follows the expected format, even when we can't verify the exact value.
457+
// We can verify that the generated debugDescription text
458+
// follows the expected general format, even when we can't verify the exact value.
460459
var actual = object.debugDescription
461460

462461
// Optional leading "-"

0 commit comments

Comments
 (0)