fix(build): drop -ffast-math so NaN convergence guards hold on macOS (4.5.1) - #39
Merged
Merged
Conversation
-ffast-math implies -ffinite-math-only, letting the compiler assume NaN/Inf never occur and fold NaN comparisons to a constant. The run-loop convergence guards rely on IEEE semantics: NaN <= terrainHeight must stay false so a poisoned trajectory never falsely completes and the step cap fires. Apple Clang folded the compare the other way, so NanModelThrowsInsteadOfHanging and TrajectoryVariantAlsoGuardsAgainstHang failed on macOS Release builds. Keep -O3. Bump version to 4.5.1.
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.
Problem
macOS CI failed on 4.5 Release:
Cause
Release built with
-ffast-math(CMakeLists.txt:69), which implies-ffinite-math-only. That lets the compiler assume NaN/Inf never occur and fold NaN comparisons to a constant.The convergence guards from bd56488 depend on IEEE semantics:
NanAerodynamicModelpoisons the trajectory with NaN, soAerialPhase::isPhaseCompletedoesNaN <= terrainHeight→ false → phase never completes → step cap fires →runtime_error. Apple Clang folded that compare the other way, so the phase "completed" early, no throw,EXPECT_THROWfailed. Linux kept it false, so CI stayed green.The same flag makes
std::isnan/isfiniteunreliable, so an explicit finite-check guard wouldn't be robust under it either. The design (safety guards that detect divergence via NaN) is incompatible with-ffinite-math-only.Fix
Drop
-ffast-math, keep-O3. Bump to 4.5.1.