Build strict: -ffp-contract=off replaces -ffast-math on every target - #54
Merged
Conversation
Enacts the estate policy for mas-bandwidth network libraries (Glenn, 2026-08-24): network libraries build with -ffp-contract=off on GCC/Clang and /fp:precise on MSVC. reliable carried -ffast-math / /fp:fast; those are gone. reliable's wire format carries no floating point -- the floats are RTT/jitter/loss/bandwidth stats -- so this is the family floor rather than a wire fix, and BUILDING.md says exactly that to consumers. CI builds through CMakeLists.txt, so every CI leg now builds strict. Verified on this bench: Release build green, all 4 ctest suites pass (test, fuzz, soak, fuzz_target), the flag confirmed on the actual compile lines of reliable.c and test.cpp (--verbose), zero remaining -ffast-math occurrences. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The first CI run of the strict build failed to link every C executable on Linux: reliable.c:1493 calls pow() for the jitter stddev, and -ffast-math had been rewriting pow(x, 0.5f) into inline sqrt, so the library never needed libm and never linked it. Strict math keeps the call. Link m PUBLIC where it exists (Linux glibc; mac and Windows carry the math functions in the base runtime), and declare -lm in Libs.private for static pkg-config consumers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Enacts Glenn's standing estate policy (2026-08-24): "generally speaking, network libraries we work on require -ffp-contract=off." serialize sets and documents the flag; yojimbo came under the policy in mas-bandwidth/yojimbo#333; netcode's equivalent is mas-bandwidth/netcode#179. This brings reliable under it.
CMakeLists.txt replaces the global
-ffast-math(GCC/Clang) and/fp:fast(MSVC) with-ffp-contract=offand/fp:precise. Globaladd_compile_options, so every target — library, test, example, soak, stats, fuzz harnesses — builds strict, and since CI drives every leg through this file, CI now enforces the flag on all platforms. BUILDING.md gains a floating point section mirroring yojimbo's, stating the flags and the consumer requirement.Honesty about scope: reliable's wire format carries no floating point — the floats in reliable.c are the RTT, jitter, packet loss and bandwidth stats. So this is the policy's floor, not a wire fix; nothing measured wrong here today, and the docs say exactly that rather than claiming a mechanism this repo does not have. The floor exists because FMA is in the aarch64 baseline and absent from the x86-64 one, so any float arithmetic that ever nears the wire diverges bit-wise between architectures unless the family builds strict.
The fast-math flags date from the premake era; serialize made the same replacement, and on MSVC there is no fast-minus-contraction spelling at all, so strict-replaces-fast is the only shape consistent across compilers.
Verified on this bench (arm64 mac, AppleClang, Release): build green, all 4 ctest suites pass (test, fuzz, soak, fuzz_target),
-ffp-contract=offconfirmed on the actual compile lines ofreliable.candtest.cppviacmake --build --verbose, zero remainingffast-mathoccurrences in the build output.🤖 Generated with Claude Code