mirror-llvm-project/libc
Jeff Bailey efe202c769
[libc][CPP] Fix ASan alloc-dealloc-mismatch in custom operator delete (#212629)
Bypass custom operator delete redirection in new.h and new.cpp when
building with AddressSanitizer (LIBC_HAS_ADDRESS_SANITIZER).

cpp::unique_ptr is the first heap-owning utility in src/__support/CPP/
that executes delete/delete[] expressions. Previously, new.h redirected
operator delete via asm-renaming to __llvm_libc_delete (calling free()),
which caused ASan to report an alloc-dealloc-mismatch (operator new vs
free) when objects allocated via host operator new were deleted by
cpp::unique_ptr.

Guarding the custom operator delete implementations under ASan enables
ASan deallocation tracking while preserving hermetic libc behavior for
non-ASan builds.

Assisted-by: Automated tooling, human reviewed.
2026-07-28 23:25:30 +01:00
..
benchmarks [libc][benchmark] allow benchmark to be built without llvm support (#200951) 2026-06-25 19:16:08 +00:00
cmake [libc][termios] Make termios hermetic and fix its compatibility with glibc 2.42 or after. (#211039) 2026-07-24 13:31:41 -04:00
config [libc] Add POSIX redirection header specifications in YAML (#211859) 2026-07-28 15:37:12 +01:00
docs [libc][math] Implement half precision lgamma function (#192834) 2026-07-19 04:29:50 +03:00
examples [libc] Fix broken links in libc (#145199) 2025-06-23 15:51:43 -07:00
fuzzing [libc] Migrate printf_core from stdio/ to __support/. (#208303) 2026-07-21 14:35:24 -07:00
hdr [libc][termios] Make termios hermetic and fix its compatibility with glibc 2.42 or after. (#211039) 2026-07-24 13:31:41 -04:00
include [libc] Add POSIX redirection header specifications in YAML (#211859) 2026-07-28 15:37:12 +01:00
lib [libc] Generate a stub for libpthread.a (#200908) 2026-06-15 23:35:20 -07:00
shared [libc][math] Implement half precision lgamma function (#192834) 2026-07-19 04:29:50 +03:00
src [libc][CPP] Fix ASan alloc-dealloc-mismatch in custom operator delete (#212629) 2026-07-28 23:25:30 +01:00
startup [libc][NFC] Port raw syscall users to existing syscall_wrappers (#208039) 2026-07-17 14:23:39 -03:00
test [libc] Implement cpp::unique_ptr utility (#206701) 2026-07-28 21:03:40 +01:00
utils [libc][math] Implement half precision lgamma function (#192834) 2026-07-19 04:29:50 +03:00
.clang-tidy
.gitignore [libc][wctype] Create generation script for classification lookup tables (#172042) 2026-01-06 12:13:28 +01:00
CMakeLists.txt [libc][termios] Make termios hermetic and fix its compatibility with glibc 2.42 or after. (#211039) 2026-07-24 13:31:41 -04:00
LICENSE.TXT
Maintainers.md [libc][freebsd] initialize freebsd support (#124459) 2026-05-19 13:04:34 -07:00
README.txt

LLVM libc
=========

This directory and its subdirectories contain source code for llvm-libc,
a retargetable implementation of the C standard library.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.