Split out of #54.
With MSVC, FASTGPX_BUILD_FUZZERS=ON builds the fuzz targets against the standalone replay driver with no instrumentation at all. The else() branch in the top-level CMakeLists.txt only prints a notice. Since 4a1d0cf the corpus replays run on the Windows leg of cpp-tests.yml, so MSVC ASan would turn that leg into a sanitized run of the seed corpora and the Catch2 tests.
What MSVC offers
/fsanitize=address (VS 2019 16.9+). AddressSanitizer only; there is no UBSan for MSVC.
- Incompatible with
/RTC1 (Debug default), /INCREMENTAL and edit-and-continue. Release with /Zi works.
- The dynamic ASan runtime DLL must be on
PATH for /MD builds. VS 2022 17.7+ copies it next to the executable for local runs; the CI runner has it via the VS install.
- Fixed by design:
-fno-sanitize-recover has no equivalent, but ASan reports are fatal on MSVC anyway.
Proposal
In the else() branch, when MSVC is set:
add_compile_options(/fsanitize=address /Zi)
add_link_options(/INCREMENTAL:NO)
plus stripping /RTC1 from CMAKE_CXX_FLAGS_DEBUG the way NDEBUG is stripped already. Verify locally with build-fuzz-msvc (ctest -R ^fuzz_) and on the Windows job of cpp-tests.yml. Note that on this ARM64 dev machine the x64 MSVC binaries run emulated, so time the corpus replay before and after.
Also worth checking: whether clang-cl (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") is worth a branch of its own, since it does have libFuzzer and UBSan on Windows.
Split out of #54.
With MSVC,
FASTGPX_BUILD_FUZZERS=ONbuilds the fuzz targets against the standalone replay driver with no instrumentation at all. Theelse()branch in the top-levelCMakeLists.txtonly prints a notice. Since 4a1d0cf the corpus replays run on the Windows leg ofcpp-tests.yml, so MSVC ASan would turn that leg into a sanitized run of the seed corpora and the Catch2 tests.What MSVC offers
/fsanitize=address(VS 2019 16.9+). AddressSanitizer only; there is no UBSan for MSVC./RTC1(Debug default),/INCREMENTALand edit-and-continue. Release with/Ziworks.PATHfor/MDbuilds. VS 2022 17.7+ copies it next to the executable for local runs; the CI runner has it via the VS install.-fno-sanitize-recoverhas no equivalent, but ASan reports are fatal on MSVC anyway.Proposal
In the
else()branch, whenMSVCis set:plus stripping
/RTC1fromCMAKE_CXX_FLAGS_DEBUGthe wayNDEBUGis stripped already. Verify locally withbuild-fuzz-msvc(ctest -R ^fuzz_) and on the Windows job ofcpp-tests.yml. Note that on this ARM64 dev machine the x64 MSVC binaries run emulated, so time the corpus replay before and after.Also worth checking: whether clang-cl (
CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") is worth a branch of its own, since it does have libFuzzer and UBSan on Windows.