Issue 139442
Summary [clang] crash on CTAD of alias template
Labels clang
Assignees
Reporter jy-lefort
    Reproduction:

```
#include <unordered_set>
#include <vector>

template <class Key,
	  class Hash = std::hash<Key>,
	  class KeyEqual = std::equal_to<Key>,
	  class Allocator = std::allocator<Key>>
using my_unordered_set = std::unordered_set<Key, Hash, KeyEqual, Allocator>;

int main (int, char **) {
    std::vector v{123};

    // this CTAD causes the crash
    auto s = my_unordered_set(v.begin(), v.end());
}
```

Crash:

```
0 libLLVM.so.20.1      0x00007f76a0c2914a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 58
1  libLLVM.so.20.1 0x00007f76a0c260d4 llvm::sys::RunSignalHandlers() + 84
2 libLLVM.so.20.1      0x00007f76a0b3f8e4
3  libc.so.6 0x00007f76a0427c30
4  libclang-cpp.so.20.1 0x00007f76a953556c clang::ASTContext::getTypeInfoImpl(clang::Type const*) const + 1036
5 libclang-cpp.so.20.1 0x00007f76a95365c7 clang::ASTContext::getPreferredTypeAlign(clang::Type const*) const + 183
6 libclang-cpp.so.20.1 0x00007f76a953496a clang::ASTContext::getDeclAlign(clang::Decl const*, bool) const + 906
7 libclang-cpp.so.20.1 0x00007f76aabf5f3f clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(clang::VarDecl const&) + 223
8  libclang-cpp.so.20.1 0x00007f76aabf1fa6 clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) + 326
9 libclang-cpp.so.20.1 0x00007f76aabf197d clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) + 61
10 libclang-cpp.so.20.1 0x00007f76aadc552b clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) + 1019
11 libclang-cpp.so.20.1 0x00007f76aadc48a1 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) + 193
12 libclang-cpp.so.20.1 0x00007f76aadd35bc clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 188
13 libclang-cpp.so.20.1 0x00007f76aae4554b clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 2011
14 libclang-cpp.so.20.1 0x00007f76aae6f0df clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 863
15 libclang-cpp.so.20.1 0x00007f76aae66ba9 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 553
16 libclang-cpp.so.20.1 0x00007f76aae6b954 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1540
17 libclang-cpp.so.20.1 0x00007f76aae65765 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 213
18 libclang-cpp.so.20.1 0x00007f76aaf2802c
19 libclang-cpp.so.20.1 0x00007f76aae32632 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 210
20 libclang-cpp.so.20.1 0x00007f76a9412e06 clang::ParseAST(clang::Sema&, bool, bool) + 646
21 libclang-cpp.so.20.1 0x00007f76abb1642f clang::FrontendAction::Execute() + 47
22 libclang-cpp.so.20.1 0x00007f76aba78cc4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1076
23 libclang-cpp.so.20.1 0x00007f76abba9f3e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 654
24 clang++ 0x000055e30c898695 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 8085
25 clang++              0x000055e30c894727
26 libclang-cpp.so.20.1 0x00007f76ab6193dd
27 libLLVM.so.20.1 0x00007f76a0b3f5f0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 144
28 libclang-cpp.so.20.1 0x00007f76ab618c95 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const + 373
29 libclang-cpp.so.20.1 0x00007f76ab5d4eb9 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 553
30 libclang-cpp.so.20.1 0x00007f76ab5d5177 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 151
31 libclang-cpp.so.20.1 0x00007f76ab5f7d39 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 489
32 clang++              0x000055e30c893b54 clang_main(int, char**, llvm::ToolContext const&) + 6452
33 clang++              0x000055e30c8a39a8 main + 104
34 libc.so.6            0x00007f76a04115f5
35 libc.so.6 0x00007f76a04116a8 __libc_start_main + 136
36 clang++ 0x000055e30c891e05 _start + 37
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 20.1.3 (Fedora 20.1.3-1.fc42)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/lib64/llvm20/bin
Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang++.cfg
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to