From afa609a1e8b120b893fbb110234504204bcedc73 Mon Sep 17 00:00:00 2001 From: Gabe DiFiore Date: Mon, 25 May 2026 20:38:19 -0400 Subject: [PATCH] fix(build): drop -ffast-math so NaN convergence guards hold on macOS -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. --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55cb4fd..4ddec54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(golf VERSION 4.5.0 LANGUAGES CXX) +project(golf VERSION 4.5.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -66,7 +66,13 @@ if(MSVC) else() # GCC/Clang flags set(CMAKE_CXX_FLAGS "-Wall -Wextra") - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math") + # No -ffast-math: it implies -ffinite-math-only, which lets the compiler + # assume NaN/Inf never occur and fold NaN comparisons to a constant. The + # convergence guards (FlightSimulator run loop + *Phase::isPhaseComplete) + # rely on IEEE semantics — `NaN <= height` must stay false so a poisoned + # trajectory never falsely "completes". Apple Clang folded it the other way, + # breaking the hang guards on macOS. + set(CMAKE_CXX_FLAGS_RELEASE "-O3") endif() # Code coverage option