Repository navigation
v15.1 — Second toolchain: clang everywhere, and what it found
v15.1 — Second toolchain: clang everywhere, and what it found
tinymind is header-only, so users compile these headers with their own toolchain. Until now CI built only with GCC, which meant clang conformance breakage reached users rather than being caught here. This release adds clang across the board and fixes everything that turning it on uncovered.
Fixes
include/compiler.hportability bug (user-facing). The header emitted#pragma GCC diagnostic ignored "-Wdangling-reference"unconditionally. That warning name is GCC 13+ only, so clang rejected it with-Wunknown-warning-option— fatal under-Werrorfor anyone building with clang. NewTINYMIND_DISABLE_WARNING_GCC_ONLY/_CLANG_ONLYmacros express single-compiler warning names correctly.- Unused-parameter diagnostics in library headers (user-facing). Five no-op policy stubs in
cpp/neuralnet.hppandloadStatesincpp/include/nnproperties.hppwere reachable by any user compiling with clang and-Werror. - Static-initialization-order UB in the Q-learning test. The weight generator and its distribution were static data members of a class template, whose dynamic initialization is unordered with respect to other non-local variables. A static learner called the generator from its own constructor, so under GCC the distribution was still zero-initialized and every network weight was 0.0 — the suite "passed" in 17 ms with a degenerate network. Fixed with function-local statics, plus bounded episode loops so a non-converging policy fails rather than hangs.
examples/mazeandexamples/dqn_mazedid not build under clang at all — an unused parameter under-Werror, found only because a size comparison happened to build them.- Test RNG made independent of the C++ standard library.
std::uniform_real_distributiondoes not specify its mapping from engine output to value, so libstdc++ and libc++ produce different draws from identical engine state and training tests diverge.unit_test/include/portable_test_random.hppfreezes the existing sequence in portable code — verified bit-identical over 20,000 draws — so no tolerance needed changing.
CI
- Clang is now a required gate, covering the embedded matrix and Boost suites, the AVX2 SIMD backend, the golden-byte exemplars, all 43 examples, and Cortex-M cross-compilation.
- The int8 pipelines are proven bit-exact across compilers: twelve exemplars produce byte-identical golden output under GCC and clang, and the Q-learning agent's full 115,498-step decision trace is identical under both.
- MemorySanitizer added, closing a gap ASan and UBSan structurally cannot cover: reads of uninitialized memory. It runs per-PR over the embedded gate corners, and nightly over the Boost suites against a purpose-built MSan-instrumented libc++.
- Branch protection went from 11 to 17 required contexts.
Docs
- The
include/compiler.hwarning-suppression macros are documented in the README, including why single-compiler warning names need the_GCC_ONLY/_CLANG_ONLYforms. - A GCC vs clang code-size comparison is in
docs/size-comparison.md: across 59 binaries the two are within half a percent in aggregate, but the per-binary spread runs from -49% to +135%, so neither compiler is uniformly better on size. .gitattributespins per-file line endings, andCLAUDE.mdnow records that a new sanitizer or CI gate must be shown to fail before it is trusted — the rule behind the MSan job's deliberate-O0.
No library API changed in this release. The core fixed-point, quantization and SIMD code needed no correctness fixes; every defect above sat at an edge.
Documentation, architecture guides, and example gallery: https://danmcleran.github.io/tinymind/
Full changelog: v15.0...v15.1