fix #10305 nim cpp is now nan-correct at CT #10310
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I finally figured out root cause of #10305, but it was a rather painful debug session
Here's a minimal test case to explain what's going on:
so
-ffast-math
affects Nan correctness;note that :
$nimc_D/config/nim.cfg
containsso that explains why this issue was only affecting
nim cpp
(since $nimc_D/compiler/extccomp.nim definedoptSpeed: " -O3 -ffast-math "
for both c and cpp, butc
was overridden by$nimc_D/config/nim.cfg
)note
there's a tradeoff between speed and accuracy at play here; but
-d:release
should be correct by default; but I added a note in doc/nimc.rst regarding more aggressive options for speed, including--passC:-ffast-math