This is an archive of the discontinued LLVM Phabricator instance.

[libc] Use MPFR for strtofloat fuzzing
ClosedPublic

Authored by michaelrj on May 18 2023, 1:34 PM.

Details

Summary

The previous string to float tests didn't check correctness, but due to
the atof differential test proving unreliable the strtofloat fuzz test
has been changed to use MPFR for correctness checking. Some minor bugs
have been found and fixed as well.

Diff Detail

Event Timeline

michaelrj created this revision.May 18 2023, 1:34 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 18 2023, 1:34 PM
michaelrj requested review of this revision.May 18 2023, 1:34 PM
lntue accepted this revision.May 18 2023, 3:12 PM
lntue added inline comments.
libc/src/__support/str_to_float.h
276

Does replacing UInt128(1) << 64 with UInt128({0, 1}) work?

282

Does replacing static_cast<UInt128>(low64(approx_middle)) << 64 with UInt128({0, low64(approx_middle)}) work?

This revision is now accepted and ready to land.May 18 2023, 3:12 PM
michaelrj added inline comments.May 18 2023, 4:00 PM
libc/src/__support/str_to_float.h
276

this UInt128 isn't necessarily the UInt class, it's a raw uint128_t when that's available, so we can't do any sort of constructor on it.

michaelrj updated this revision to Diff 523954.May 19 2023, 3:48 PM
michaelrj marked 2 inline comments as done.

changed how MPFR is included to support downstream configs in the same way as MPFRUtils

lntue accepted this revision.May 19 2023, 6:53 PM
This revision was automatically updated to reflect the committed changes.