Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get CI building again, for Clang 16+ and GCC #461

Merged
merged 11 commits into from
Dec 29, 2024
Merged

Conversation

danakj
Copy link
Collaborator

@danakj danakj commented Dec 29, 2024

No description provided.

@danakj danakj changed the title Install development packages for clang 16 when it's the system clang Get CI building again for clang 16+ Dec 29, 2024
@danakj danakj changed the title Get CI building again for clang 16+ Get CI building again Dec 29, 2024
@danakj danakj changed the title Get CI building again Get CI building again, for Clang 16+ and GCC Dec 29, 2024
…tently

The system headers end up included regardless. But if the libc++abi
headers are there too, they conflict as they have a different signature
for the __cxa_init_primary_exception function.

See also: llvm/llvm-project#121300
Fix invalid compile-time usage of non-literal types to get the tests
passing.
StructuralType was introduced as another type of template parameter. And the template
apis were changed to include more information, which requires digging through extra
steps to get to the same info we were before.
This gives us a sanitizer on the oldest build (16) and the latest build
(19). We would expect most development on the library to happen on LLVM
19, and we want any improvements to the sanitizer if there are some.
We were doing nullptr + alignof(T) to make the same type of
invalid pointer that Rust would use, but this is UB in C++. We
can only create such invalid pointers through reinterpret_cast
of an integer value, which can't be constexpr.
This reverts commit a67c5e8.

LLVM 19 has use-after-poison errors under ASAN inside of ClangTool:

==95109==ERROR: AddressSanitizer: use-after-poison on address 0x62100000291a at pc 0x00010994cffc bp 0x00016d742690 sp 0x00016d741e40
WRITE of size 13 at 0x62100000291a thread T0
    #0 0x00010994cff8 in memcpy+0x4c0 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x50ff8)
    chromium#1 0x0001050b7f68 in llvm::StringSaver::save(llvm::Twine const&)+0xf4 (subdoc_unittests:arm64+0x1029fff68)
    chromium#2 0x000102ffc1c8 in void llvm::function_ref<void (llvm::Twine const&)>::callback_fn<clang::CompilerInvocationBase::generateCC1CommandLine(llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>) const::'lambda'(llvm::Twine const&)>(long, llvm::Twine const&)+0x2c (subdoc_unittests:arm64+0x1009441c8)
    chromium#3 0x000102fba4e4 in clang::CompilerInvocationBase::GenerateDiagnosticArgs(clang::DiagnosticOptions const&, llvm::function_ref<void (llvm::Twine const&)>, bool)+0x9d4 (subdoc_unittests:arm64+0x1009024e4)
    chromium#4 0x000102fe47b0 in clang::CompilerInvocationBase::generateCC1CommandLine(llvm::function_ref<void (llvm::Twine const&)>) const+0xe80 (subdoc_unittests:arm64+0x10092c7b0)
    chromium#5 0x000102ffd914 in void llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>::callback_fn<clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)::$_1>(long, clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)+0x64 (subdoc_unittests:arm64+0x100945914)
    chromium#6 0x000102fa0554 in RoundTrip(llvm::function_ref<bool (clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)>, llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>, clang::CompilerInvocation&, clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*, bool, bool)+0x358 (subdoc_unittests:arm64+0x1008e8554)
    chromium#7 0x000102fe07d0 in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)+0x64 (subdoc_unittests:arm64+0x1009287d0)
    chromium#8 0x000102f5f85c in clang::tooling::ToolInvocation::run()+0x364 (subdoc_unittests:arm64+0x1008a785c)
    chromium#9 0x000102f625f8 in clang::tooling::ClangTool::run(clang::tooling::ToolAction*)+0xd40 (subdoc_unittests:arm64+0x1008aa5f8)
    chromium#10 0x000102d428a8 in subdoc::run_files(clang::tooling::CompilationDatabase const&, sus::collections::Vec<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, subdoc::RunOptions const&)+0x750 (subdoc_unittests:arm64+0x10068a8a8)
    chromium#11 0x000102d41a84 in subdoc::run_test(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, sus::collections::Slice<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, subdoc::RunOptions const&)+0x6b8 (subdoc_unittests:arm64+0x100689a84)
    chromium#12 0x00010276b63c in SubDocTest::run_code_with_options(subdoc::RunOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)+0x2ec (subdoc_unittests:arm64+0x1000b363c)
    chromium#13 0x00010276af98 in SubDocTest::run_code(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)+0x2b8 (subdoc_unittests:arm64+0x1000b2f98)
    chromium#14 0x0001027f75a0 in SubDocTest_NamespaceNested_Test::TestBody()+0x2b8 (subdoc_unittests:arm64+0x10013f5a0)
    chromium#15 0x0001092a242c in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)+0xc8 (libgtest.1.13.0.dylib:arm64+0x10a42c)
    chromium#16 0x0001091d9234 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)+0x1a0 (libgtest.1.13.0.dylib:arm64+0x41234)
    chromium#17 0x0001091d8fe0 in testing::Test::Run()+0x18c (libgtest.1.13.0.dylib:arm64+0x40fe0)
    chromium#18 0x0001091db5a4 in testing::TestInfo::Run()+0x46c (libgtest.1.13.0.dylib:arm64+0x435a4)
    chromium#19 0x0001091ddeb0 in testing::TestSuite::Run()+0x3f8 (libgtest.1.13.0.dylib:arm64+0x45eb0)
    chromium#20 0x0001091ff73c in testing::internal::UnitTestImpl::RunAllTests()+0xa60 (libgtest.1.13.0.dylib:arm64+0x6773c)
    chromium#21 0x0001092a3a2c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)+0xc8 (libgtest.1.13.0.dylib:arm64+0x10ba2c)
    chromium#22 0x0001091fe85c in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)+0x1a0 (libgtest.1.13.0.dylib:arm64+0x6685c)
    chromium#23 0x0001091fe47c in testing::UnitTest::Run()+0x244 (libgtest.1.13.0.dylib:arm64+0x6647c)
    chromium#24 0x000102ba685c in RUN_ALL_TESTS()+0xc (subdoc_unittests:arm64+0x1004ee85c)
    chromium#25 0x000102ba5bd4 in main+0x2bc (subdoc_unittests:arm64+0x1004edbd4)
    chromium#26 0x00019643f150  (<unknown module>)
    chromium#27 0xa2187ffffffffffc  (<unknown module>)

0x62100000291a is located 26 bytes inside of 4096-byte region [0x621000002900,0x621000003900)
allocated by thread T0 here:
    #0 0x00010994f944 in __sanitizer_mz_memalign+0x78 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x53944)
    chromium#1 0x0001966041bc in _malloc_zone_memalign+0x138 (libsystem_malloc.dylib:arm64+0x2c1bc)
    chromium#2 0xf071800196782cd4  (<unknown module>)
    chromium#3 0x1510000102a3830c  (<unknown module>)
    chromium#4 0x000102a38714 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::StartNewSlab()+0x4c (subdoc_unittests:arm64+0x100380714)
    chromium#5 0x000102a38070 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::AllocateSlow(unsigned long, unsigned long, llvm::Align)+0x2d0 (subdoc_unittests:arm64+0x100380070)
    chromium#6 0x0001050b7fe8 in llvm::StringSaver::save(llvm::Twine const&)+0x174 (subdoc_unittests:arm64+0x1029fffe8)
    chromium#7 0x000102ffc1c8 in void llvm::function_ref<void (llvm::Twine const&)>::callback_fn<clang::CompilerInvocationBase::generateCC1CommandLine(llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>) const::'lambda'(llvm::Twine const&)>(long, llvm::Twine const&)+0x2c (subdoc_unittests:arm64+0x1009441c8)
    chromium#8 0x000102feb5e4 in denormalizeStringImpl(llvm::function_ref<void (llvm::Twine const&)>, llvm::Twine const&, llvm::opt::Option::OptionClass, unsigned int, llvm::Twine const&)+0xb0 (subdoc_unittests:arm64+0x1009335e4)
    chromium#9 0x000102feb884 in denormalizeStringVector(llvm::function_ref<void (llvm::Twine const&)>, llvm::Twine const&, llvm::opt::Option::OptionClass, unsigned int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&)+0x1b4 (subdoc_unittests:arm64+0x100933884)
    chromium#10 0x000102fb9d74 in clang::CompilerInvocationBase::GenerateDiagnosticArgs(clang::DiagnosticOptions const&, llvm::function_ref<void (llvm::Twine const&)>, bool)+0x264 (subdoc_unittests:arm64+0x100901d74)
    chromium#11 0x000102fe47b0 in clang::CompilerInvocationBase::generateCC1CommandLine(llvm::function_ref<void (llvm::Twine const&)>) const+0xe80 (subdoc_unittests:arm64+0x10092c7b0)
    chromium#12 0x000102ffd914 in void llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>::callback_fn<clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)::$_1>(long, clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)+0x64 (subdoc_unittests:arm64+0x100945914)
    chromium#13 0x000102fa0554 in RoundTrip(llvm::function_ref<bool (clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)>, llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>, clang::CompilerInvocation&, clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*, bool, bool)+0x358 (subdoc_unittests:arm64+0x1008e8554)
    chromium#14 0x000102fe07d0 in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)+0x64 (subdoc_unittests:arm64+0x1009287d0)
    chromium#15 0x000102f5f85c in clang::tooling::ToolInvocation::run()+0x364 (subdoc_unittests:arm64+0x1008a785c)
    chromium#16 0x000102f625f8 in clang::tooling::ClangTool::run(clang::tooling::ToolAction*)+0xd40 (subdoc_unittests:arm64+0x1008aa5f8)
    chromium#17 0x000102d428a8 in subdoc::run_files(clang::tooling::CompilationDatabase const&, sus::collections::Vec<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, subdoc::RunOptions const&)+0x750 (subdoc_unittests:arm64+0x10068a8a8)
    chromium#18 0x000102d41a84 in subdoc::run_test(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, sus::collections::Slice<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, subdoc::RunOptions const&)+0x6b8 (subdoc_unittests:arm64+0x100689a84)

It's not immediately obvious what is wrong, maybe a bug in StringSaver.
The StringSaver itself should be on the stack still, I think.
@danakj danakj mentioned this pull request Dec 29, 2024
@danakj danakj merged commit fce12ae into chromium:main Dec 29, 2024
10 checks passed
@danakj danakj deleted the 16 branch December 29, 2024 22:23
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