From 199b6ff3fb91f7d7c81f5bfaaaea0935bd2fcbea Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sun, 12 Oct 2025 17:36:45 +0300 Subject: [PATCH] Disable detect_odr_violation for ASan There's some unfortunate ODR violations that get dianosed with GCC but not Clang for static inline constexpr variables defined inside the class body: template struct static_const { static JSON_INLINE_VARIABLE constexpr T value{}; }; This can be ignored pretty much. There is the same problem for std::piecewise_construct: http://lists.boost.org/Archives/boost/2007/06/123353.php ==2455704==ERROR: AddressSanitizer: odr-violation (0x7efddc460e20): [1] size=1 'value' /nix/store/235hvgzcbl06fxy53515q8sr6lljvf68-nlohmann_json-3.11.3/include/nlohmann/detail/meta/cpp_future.hpp:156:45 in /nix/store/pkmljfq97a83dbanr0n64zbm8cyhna33-nix-store-2.33.0pre/lib/libnixstore.so.2.33.0 [2] size=1 'value' /nix/store/235hvgzcbl06fxy53515q8sr6lljvf68-nlohmann_json-3.11.3/include/nlohmann/detail/meta/cpp_future.hpp:156:45 in /nix/store/gbjpkjj0g8vk20fzlyrwj491gwp6g1qw-nix-util-2.33.0pre/lib/libnixutil.so.2.33.0 --- nix-meson-build-support/common/asan-options/asan-options.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-meson-build-support/common/asan-options/asan-options.cc b/nix-meson-build-support/common/asan-options/asan-options.cc index 651354bac..c9782fea0 100644 --- a/nix-meson-build-support/common/asan-options/asan-options.cc +++ b/nix-meson-build-support/common/asan-options/asan-options.cc @@ -2,5 +2,5 @@ extern "C" [[gnu::retain, gnu::weak]] const char * __asan_default_options() { // We leak a bunch of memory knowingly on purpose. It's not worthwhile to // diagnose that memory being leaked for now. - return "abort_on_error=1:print_summary=1:detect_leaks=0"; + return "abort_on_error=1:print_summary=1:detect_leaks=0:detect_odr_violation=0"; }