Page MenuHomeFreeBSD

Fix printf(3) output of long doubles on RISC-V
ClosedPublic

Authored by mhorne on Jun 23 2020, 8:33 PM.
Tags
None
Referenced Files
F109307016: D25420.diff
Mon, Feb 3, 8:45 AM
Unknown Object (File)
Dec 2 2024, 3:18 PM
Unknown Object (File)
Nov 15 2024, 3:19 PM
Unknown Object (File)
Oct 16 2024, 1:46 PM
Unknown Object (File)
Sep 27 2024, 4:10 PM
Unknown Object (File)
Sep 24 2024, 2:28 PM
Unknown Object (File)
Sep 24 2024, 2:17 PM
Unknown Object (File)
Sep 20 2024, 3:46 PM
Subscribers

Details

Summary

When the RISC-V port was initially committed to FreeBSD, GCC would
generate 64-bit long doubles, and the definitions in _fpmath.h reflected
that. This was changed to 128-bit in GCC later that year [1], but the
definitions were never updated. This causes printf(3) and friends to
interpret only the low 64-bits of a long double in ldtoa, thereby
printing incorrect values.

Update the definitions now that both clang and GCC generate 128-bit long
doubles.

PR: 242067

[1] https://github.com/riscv/riscv-gcc/commit/54b21fc5ae83cefec44bc2caed4a8c664c274ba0

Test Plan

Verify that the test program from the PR gives the expected output for libc built with clang and gcc.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31908
Build 29460: arc lint + arc unit

Event Timeline

mhorne created this revision.
This revision was not accepted when it landed; it landed in state Needs Review.Jun 29 2020, 7:30 PM
This revision was automatically updated to reflect the committed changes.