Page MenuHomeFreeBSD

printf: Avoid setting FE_INEXACT in printf()
AcceptedPublic

Authored by arichardson on Feb 19 2021, 12:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 10, 4:49 PM
Unknown Object (File)
Thu, Apr 25, 12:06 AM
Unknown Object (File)
Mar 12 2024, 3:04 AM
Unknown Object (File)
Feb 17 2024, 11:08 PM
Unknown Object (File)
Jan 21 2024, 10:22 PM
Unknown Object (File)
Dec 20 2023, 6:17 AM
Unknown Object (File)
Nov 20 2023, 3:17 PM
Unknown Object (File)
Nov 4 2023, 2:43 PM
Subscribers

Details

Reviewers
dim
Summary

The k = (int)ds; cast inside gdtoa/dtoa can set FE_INEXACT.
Having printf() change the FE_INEXACT flag results in some of the
msun tests failing when compiling them with debugging flags.
To avoid this, save the state of FE_INEXACT before calling gdtoa()
and clear it if gdtoa() set it.

Test Plan

building msun with -DDOPRINT -DDEBUG -DDOPRINT_LD80 no longer causes all tests to fail

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 37185
Build 34074: arc lint + arc unit

Event Timeline

Hm, wouldn't it be better to fix this in gdtoa() instead? Then it would be solved for all gdtoa() consumers. That said, I've understood that the gdtoa code is very impenetrable...

In D28787#646949, @dim wrote:

Hm, wouldn't it be better to fix this in gdtoa() instead? Then it would be solved for all gdtoa() consumers. That said, I've understood that the gdtoa code is very impenetrable...

I had a brief look at modifying the gdtoa code, but it seemed to be quite akward so I chose to change the wrapper instead.

In D28787#646949, @dim wrote:

Hm, wouldn't it be better to fix this in gdtoa() instead? Then it would be solved for all gdtoa() consumers. That said, I've understood that the gdtoa code is very impenetrable...

I had a brief look at modifying the gdtoa code, but it seemed to be quite akward so I chose to change the wrapper instead.

Well, if printf is the only consumer of gdtoa, then this is OK with me. Otherwise I'd just hide the "real" gdtoa behind the wrapper for everybody.

This revision is now accepted and ready to land.Feb 23 2021, 8:28 PM
This revision now requires review to proceed.Mar 1 2021, 12:45 PM

If this also works for softfloat now, please go ahead.

This revision is now accepted and ready to land.Mar 5 2021, 8:46 PM