Page MenuHomeFreeBSD

printf: Avoid setting FE_INEXACT in printf()
AcceptedPublic

Authored by arichardson on Feb 19 2021, 12:57 PM.
Tags
None
Referenced Files
F108466337: D28787.id84256.diff
Sat, Jan 25, 3:54 AM
Unknown Object (File)
Tue, Jan 21, 4:10 AM
Unknown Object (File)
Mon, Jan 20, 12:32 PM
Unknown Object (File)
Sat, Jan 18, 2:33 PM
Unknown Object (File)
Fri, Jan 10, 8:17 AM
Unknown Object (File)
Sun, Jan 5, 12:04 PM
Unknown Object (File)
Dec 22 2024, 3:57 AM
Unknown Object (File)
Nov 3 2024, 2:09 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