You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add LLVM 22 ASan CI coverage and fix the issues it surfaced.
Add an ubu24-clang22-runtime22-asan row that consumes the llvm-asan
recipe from compiler-research/ci-workflows. Three consumer-side build
gaps had to be closed to let clad link against the recipe toolchain:
CMAKE_C_COMPILER/CMAKE_C_FLAGS are now swapped symmetrically with their
CXX counterparts for the unittests subdir (gtest otherwise configured
with a mixed toolchain); CMAKE_POSITION_INDEPENDENT_CODE is forced ON
(the sanitizer recipe's _INIT plumbing weakened LLVM's default -fPIC
enough that libcladDifferentiator.a ended up non-PIC and hit an
R_X86_64_PC32 link error); and clad_externalproject_add strips
-fsanitize=* from the flags it forwards, as CppInterOp does, so the
recipe -- which ships no libclang_rt -- can be consumed at all.
Two latent crashes surfaced once the sanitizer runtime started
shipping. clang::NestedNameSpecifier()'s default ctor builds
FlagKind::Invalid in clang 22 (Null is the std::nullopt ctor), so three
compat wrappers that used it for "no qualifier" produced an NNS that
converted to bool true and UNREACHABLE'd inside getKind(); they now use
the null sentinel. And cloneFunction's RebuildEnclosingNamespaces leaked
one clang::Scope per enclosing namespace because the outer
SaveAndRestore<Scope*> restored the pointer without deleting the chain;
cloneFunction now returns an RAII ClonedFunction that pops the scopes
(and their DeclContext pushes) in its destructor. CreateDerivativeOverload
and CreateVectorModeOverload, which rebuild the same namespaces while the
caller's handle is still live, bracket their state with SaveAndRestore so
the outer handle does not pop past the TU and crash.
Two hygiene changes round it out: DifferentiationOptions uses plain
default-initialised bool instead of `: 1` bit-fields (the packed ctor
did a read-modify-write of still-uninitialised storage bytes), and clad
resolves its own plugin path from a clad-owned symbol -- dladdr on POSIX,
GetModuleHandleExA + GetModuleFileNameA on Windows -- rather than
scraping FrontendOpts().Plugins. <windows.h> is included with NOMINMAX so
its min/max macros do not mangle std::numeric_limits<>::max() in
llvm/ADT/Sequence.h.
MSan is intentionally left out: clad runs as an in-process plugin inside
a clang whose own code is not uniformly instrumented, so every std object
crossing the clang->clad.so boundary reads as poisoned. Sound MSan
coverage needs clad statically linked into an instrumented clang, which
is follow-up infrastructure.
0 commit comments