Skip to content

🩹 Disable ASan on macOS 14/15 with LLVM/Clang 22+ - #60

Merged
kammce merged 1 commit into
mainfrom
asan-macos-bundled-libcxx
Oct 12, 2026
Merged

kammce merged 1 commit into
mainfrom
asan-macos-bundled-libcxx

Conversation

@kammce

@kammce kammce commented Oct 12, 2026

Copy link
Copy Markdown
Member

On macOS 14/15, llvm-toolchain links LLVM 22/23 programs against its bundled @rpath/libc++.1.dylib, but LLVM's ASan runtime (libclang_rt.asan_osx_dynamic.dylib) links against the system /usr/lib/libc++.1.dylib. Both end up in the test process, and ASan aborts at exit:

AddressSanitizer: attempting free on address which was not malloc()-ed
  in std::__1::locale::~locale() (/usr/lib/libc++.1.dylib)

The tests themselves pass. This broke libhal/v5 CI on macos-15 building scatter_span with LLVM 23.

The existing ASan check now also disables ASan for upstream Clang 22+ on macOS 14/15, exactly where the toolchain bundles libc++. The Clang 20 / macOS 26+ case is unchanged. I ran the check logic over macOS 13.6/14.7/15.5/26/27 with Clang 20/21/22/23 and AppleClang, and it disables ASan only in those two cases.

On macOS 14/15, llvm-toolchain links LLVM 22/23 programs against its
bundled libc++, but the ASan runtime links against the system libc++.
Both load into the test process, objects from one are freed by the
other, and ASan aborts at exit (bad-free in std::locale::~locale).
@kammce
kammce merged commit 1be428c into main Oct 12, 2026
1 check passed
@kammce
kammce deleted the asan-macos-bundled-libcxx branch October 12, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant