[libc-commits] [PATCH] D145821: [libc][NFC] add an atof test for a fuzz failure

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Mar 10 11:55:46 PST 2023


michaelrj created this revision.
michaelrj added a reviewer: lntue.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
michaelrj requested review of this revision.

The differential fuzzer found that glibc and our libc disagree on the
result for "0x30000002222225p-1077", with ours being rounded up and
theirs rounded down. Ours is more correct for the nearest rounding mode,
so only a test is added.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145821

Files:
  libc/test/src/stdlib/strtod_test.cpp


Index: libc/test/src/stdlib/strtod_test.cpp
===================================================================
--- libc/test/src/stdlib/strtod_test.cpp
+++ libc/test/src/stdlib/strtod_test.cpp
@@ -191,4 +191,8 @@
            "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN?",
            0, uint64_t(0));
   run_test("0x.666E40", 9, uint64_t(0x3fd99b9000000000));
+
+  // glibc disagrees with this result, but ours is correct for the nearest
+  // rounding mode.
+  run_test("0x30000002222225p-1077", 22, uint64_t(0x0006000000444445), ERANGE);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145821.504241.patch
Type: text/x-patch
Size: 549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230310/8eb1115e/attachment.bin>


More information about the libc-commits mailing list