From 927d0f89c369c6dcd7047bd5c113eae3b3beb148 Mon Sep 17 00:00:00 2001 From: Rafael Diniz Date: Sat, 4 Jul 2026 17:38:46 +0100 Subject: [PATCH 1/2] build: add missing includes (memset) for modern GCC GCC no longer transitively provides memset via the other headers, so Delay.cpp and Path.cpp failed to compile with 'memset was not declared in this scope' (observed with GCC 14 / Debian trixie). Co-Authored-By: Claude Fable 5 (cherry picked from commit 0d321359d6f142b8829eab1f49f982ed001ca5d5) --- Delay.cpp | 2 ++ Path.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/Delay.cpp b/Delay.cpp index fa0b4ea..00ee1dd 100644 --- a/Delay.cpp +++ b/Delay.cpp @@ -1,6 +1,8 @@ // Delay.cpp: implementation of the CDelay class. // ( also performs Hilbert Real to complex I/Q 3KHz filtering ) +#include + #include "Delay.h" #include "FilterTables.h" diff --git a/Path.cpp b/Path.cpp index 7c5244a..006721a 100644 --- a/Path.cpp +++ b/Path.cpp @@ -1,6 +1,7 @@ #include "Path.h" #include +#include #define _USE_MATH_DEFINES #include From b24f67c019c510d72e34b176c406dcfc6895d005 Mon Sep 17 00:00:00 2001 From: Rafael Diniz Date: Sat, 4 Jul 2026 19:20:35 +0100 Subject: [PATCH 2/2] fix: C++17 evaluation-order bug destroyed the signal in the AWGN stage pInOut[i] = siggain * pInOut[i++] + acc evaluates the RHS (including the i++ side effect) BEFORE the left-hand subscript under C++17 sequencing rules, so every store landed at pInOut[i+1], overwriting the next input sample before it was read. Any run with --snr produced garbage audio (an OFDM modem decodes 0 frames from it even at SNR 20 with no fading); the pre-C++17 MSVC build this was ported from happened to evaluate the subscript first. Split the increment onto its own statement. Found by cross-validating pathsim against Rhizomatica/mercury's Watterson channel with freedv OFDM data frames as the probe signal. Co-Authored-By: Claude Fable 5 (cherry picked from commit f76d1e17c420d77c703d7c8ab7a1ad689a8bff17) --- NoiseGen.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/NoiseGen.cpp b/NoiseGen.cpp index a01a1a4..d5a9268 100644 --- a/NoiseGen.cpp +++ b/NoiseGen.cpp @@ -56,8 +56,13 @@ void NoiseGen::add_band_limited_noise(int bufsize, double *pInOut, double siggai m_queue_pos = HILBPFIR_LENGTH - 1; } else acc = noise[j]; - // Add BP filtered noise to signal - pInOut[i] = siggain * pInOut[i ++] + acc; + // Add BP filtered noise to signal. + // NB: this must not be written as pInOut[i] = ... pInOut[i++] ...: + // since C++17 the RHS (including i++) is sequenced BEFORE the + // left-hand subscript, so the store lands at pInOut[i+1] and + // destroys the next input sample before it is read. + pInOut[i] = siggain * pInOut[i] + acc; + ++ i; } } }