This is an archive of the discontinued LLVM Phabricator instance.

[libcxxabi] Make test tolerant of uncommon floating literal demanglings
ClosedPublic

Authored by bcraig on Jan 8 2016, 12:18 PM.

Details

Summary

libcxxabi uses the C99 library's %a format specifier to turn a floating point value into a hexadecimal string representation. The %a format specifier is rather loosely defined in the C spec though, and some C libraries emit a different (but valid) string for a given floating point value. In particular, the C spec only requires that there is a single, non-zero hexadecimal digit on the left of the decimal point. Given that constraint, there are typically four different valid representations of a floating point number. I have updated the test to accept any of the valid representations for demangled floating point literals.

Diff Detail

Event Timeline

bcraig updated this revision to Diff 44358.Jan 8 2016, 12:18 PM
bcraig retitled this revision from to [libcxxabi] Make test tolerant of uncommon floating literal demanglings.
bcraig updated this object.
bcraig added reviewers: howard.hinnant, logan, EricWF.
bcraig added a subscriber: cfe-commits.
EricWF accepted this revision.Jan 20 2016, 2:57 AM
EricWF edited edge metadata.

LGTM.

I don't see anything in the Itanium ABI spec that would prefer one demangling over another.
I also double checked that scanf("%a", ...) generates the expected bit-pattern for each test value.

Thanks for the patch.

This revision is now accepted and ready to land.Jan 20 2016, 2:57 AM
bcraig closed this revision.Jan 20 2016, 6:13 AM