Skip to content

Clang 18 llvm::report_bad_alloc_error in Sema::CheckConstraintSatisfaction #66938

@danakj

Description

@danakj

This happened in the last few days, showed up on my CI run today.

/usr/bin/clang++-18  -I/home/runner/work/subspace/subspace -I/home/runner/work/subspace/subspace/third_party/fmt/include -isystem /usr/include/c++/12 -isystem /usr/include/x86_64-linux-gnu/c++/12 -isystem /usr/include/c++/12/backward -isystem /usr/lib/llvm-18/lib/clang/18/include -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include -O3 -DNDEBUG -std=c++20 -fno-rtti -Wno-nullability-completeness -MD -MT sus/CMakeFiles/subspace.dir/lib/lib.cc.o -MF sus/CMakeFiles/subspace.dir/lib/lib.cc.o.d -o sus/CMakeFiles/subspace.dir/lib/lib.cc.o -c /home/runner/work/subspace/subspace/sus/lib/lib.cc
LLVM ERROR: out of memory
Allocation failed
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /usr/bin/clang++-18 -I/home/runner/work/subspace/subspace -I/home/runner/work/subspace/subspace/third_party/fmt/include -isystem /usr/include/c++/12 -isystem /usr/include/x86_64-linux-gnu/c++/12 -isystem /usr/include/c++/12/backward -isystem /usr/lib/llvm-18/lib/clang/18/include -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include -O3 -DNDEBUG -std=c++20 -fno-rtti -Wno-nullability-completeness -MD -MT sus/CMakeFiles/subspace.dir/lib/lib.cc.o -MF sus/CMakeFiles/subspace.dir/lib/lib.cc.o.d -o sus/CMakeFiles/subspace.dir/lib/lib.cc.o -c /home/runner/work/subspace/subspace/sus/lib/lib.cc
1.	/home/runner/work/subspace/subspace/sus/num/__private/unsigned_integer_methods.inc:473:33: current parser token ';'
2.	/home/runner/work/subspace/subspace/sus/num/unsigned_integer.h:44:1: parsing namespace 'sus'
3.	/home/runner/work/subspace/subspace/sus/num/unsigned_integer.h:51:1: parsing struct/union/class body 'sus::num::u32'
4.	/home/runner/work/subspace/subspace/sus/num/__private/unsigned_integer_methods.inc:472:1: parsing function body 'sus::num::u32::from_product'
5.	/home/runner/work/subspace/subspace/sus/num/__private/unsigned_integer_methods.inc:472:1: in compound statement ('{}')
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM-18.so.1    0x00007f1fc2f[26](https://github.com/chromium/subspace/actions/runs/6252318951/job/16975334258#step:7:27)cd6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 54
1  libLLVM-18.so.1    0x00007f1fc2f24c90 llvm::sys::RunSignalHandlers() + 80
2  libLLVM-18.so.1    0x00007f1fc2e77470
3  libc.so.6          0x00007f1fc1a42520
4  libc.so.6          0x00007f1fc1a96a7c pthread_kill + 300
5  libc.so.6          0x00007f1fc1a42476 raise + 22
6  libc.so.6          0x00007f1fc1a287f3 abort + 211
7  libLLVM-18.so.1    0x00007f1fc2e853c4 llvm::report_bad_alloc_error(char const*, bool) + 132
8  libLLVM-18.so.1    0x00007f1fc2ec21f0 llvm::SmallVectorBase<unsigned int>::size() const + 0
9  libclang-cpp.so.18 0x00007f1fcaf98a74 llvm::SmallVectorImpl<std::pair<clang::Expr const*, llvm::PointerUnion<clang::Expr*, std::pair<clang::SourceLocation, llvm::StringRef>*>>>::operator=(llvm::SmallVectorImpl<std::pair<clang::Expr const*, llvm::PointerUnion<clang::Expr*, std::pair<clang::SourceLocation, llvm::StringRef>*>>> const&) + 68
10 libclang-cpp.so.18 0x00007f1fcaf917cb clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*, llvm::ArrayRef<clang::Expr const*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::MultiLevelTemplateArgumentList const&, clang::SourceRange, clang::ConstraintSatisfaction&) + 1995
11 libclang-cpp.so.18 0x00007f1fcb49bff7 clang::Sema::CheckConceptTemplateId(clang::CXXScopeSpec const&, clang::SourceLocation, clang::DeclarationNameInfo const&, clang::NamedDecl*, clang::ConceptDecl*, clang::TemplateArgumentListInfo const*) + 7[27](https://github.com/chromium/subspace/actions/runs/6252318951/job/16975334258#step:7:28)
12 libclang-cpp.so.18 0x00007f1fcb5a91b2
63 clang++-18         0x000055e22988d545
64 libclang-cpp.so.18 0x00007f1fcc060609
65 libLLVM-18.so.1    0x00007f1fc2e7720c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 140
66 libclang-cpp.so.18 0x00007f1fcc05ff7e clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const + 366
67 libclang-cpp.so.18 0x00007f1fcc0[28](https://github.com/chromium/subspace/actions/runs/6252318951/job/16975334258#step:7:29)c51 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 897
68 libclang-cpp.so.18 0x00007f1fcc028e9e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 142
69 libclang-cpp.so.18 0x00007f1fcc04477c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 332
70 clang++-18         0x000055e2[29](https://github.com/chromium/subspace/actions/runs/6252318951/job/16975334258#step:7:30)88cea4 clang_main(int, char**, llvm::ToolContext const&) + 11252
71 clang++-18         0x000055e229899aa2 main + 50
72 libc.so.6          0x00007f1fc1a29d90
73 libc.so.6          0x00007f1fc1a29e40 __libc_start_main + 128
74 clang++-18         0x000055e229889f55 _start + 37
clang++-18: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Ubuntu clang version 18.0.0 (++202[30](https://github.com/chromium/subspace/actions/runs/6252318951/job/16975334258#step:7:31)920042413+678c1f142c06-1~exp1~202309200425[33](https://github.com/chromium/subspace/actions/runs/6252318951/job/16975334258#step:7:34).1196)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang++-18: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++-18: note: diagnostic msg: /tmp/lib-6aff51.cpp
clang++-18: note: diagnostic msg: /tmp/lib-6aff51.sh
clang++-18: note: diagnostic msg: 

********************

cc: @cor3ntin

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"crashPrefer [crash-on-valid] or [crash-on-invalid]needs-reductionLarge reproducer that should be reduced into a simpler form

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions