Page MenuHomeFreeBSD

printf: Avoid setting FE_INEXACT in printf()
AcceptedPublic

Authored by arichardson on Fri, Feb 19, 12:57 PM.

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 OK
Unit
No Unit 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.Tue, Feb 23, 8:28 PM