[llvm-bugs] [Bug 47870] New: unreachable executed with CTAD in return type

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 15 19:01:59 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47870

            Bug ID: 47870
           Summary: unreachable executed with CTAD in return type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The following code

```
template<typename T>
struct S {
        explicit S(T);
};

template<typename T>
auto insert(T value) -> decltype(S(value));

void f(int other) {
        insert(other);
}
```

Fails with the following message

```
mangling a placeholder type
UNREACHABLE executed at /home/david/llvm/clang/lib/AST/ItaniumMangle.cpp:2771!
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/david/llvm/build/bin/clang++ -std=c++17 -o
/dev/null -c ../bounded-integer/source/bounded/integer.cpp 
1.      <eof> parser at end of file
2.      ../bounded-integer/source/bounded/integer.cpp:9:6: LLVM IR generation
of declaration 'f'
3.      ../bounded-integer/source/bounded/integer.cpp:9:6: Generating code for
declaration 'f'
4.      ../bounded-integer/source/bounded/integer.cpp:7:6: Mangling declaration
'insert'
 #0 0x00005570c95bea31 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/david/llvm/build/bin/clang+++0x1da6a31)
 #1 0x00005570c95bc5de llvm::sys::RunSignalHandlers()
(/home/david/llvm/build/bin/clang+++0x1da45de)
 #2 0x00005570c95bdd20 llvm::sys::CleanupOnSignal(unsigned long)
(/home/david/llvm/build/bin/clang+++0x1da5d20)
 #3 0x00005570c9540de3 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
(/home/david/llvm/build/bin/clang+++0x1d28de3)
 #4 0x00005570c9540f55 CrashRecoverySignalHandler(int)
(/home/david/llvm/build/bin/clang+++0x1d28f55)
 #5 0x00007f2441abc0f0 __restore_rt (/usr/lib/libpthread.so.0+0x140f0)
 #6 0x00007f2441541615 raise (/usr/lib/libc.so.6+0x3d615)
 #7 0x00007f244152a862 abort (/usr/lib/libc.so.6+0x26862)
 #8 0x00005570c9545991 (/home/david/llvm/build/bin/clang+++0x1d2d991)
 #9 0x00005570cc07e3ed (anonymous
namespace)::CXXNameMangler::mangleType(clang::BuiltinType const*)
(/home/david/llvm/build/bin/clang+++0x48663ed)
#10 0x00005570cc07c1ac (anonymous
namespace)::CXXNameMangler::mangleType(clang::QualType)
(/home/david/llvm/build/bin/clang+++0x48641ac)
#11 0x00005570cc08377d (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/home/david/llvm/build/bin/clang+++0x486b77d)
#12 0x00005570cc07ccb3 (anonymous
namespace)::CXXNameMangler::mangleType(clang::QualType)
(/home/david/llvm/build/bin/clang+++0x4864cb3)
#13 0x00005570cc08b786 (anonymous
namespace)::CXXNameMangler::mangleBareFunctionType(clang::FunctionProtoType
const*, bool, clang::FunctionDecl const*)
(/home/david/llvm/build/bin/clang+++0x4873786)
#14 0x00005570cc0795d5 (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding(clang::GlobalDecl)
(/home/david/llvm/build/bin/clang+++0x48615d5)
#15 0x00005570cc079348 (anonymous
namespace)::CXXNameMangler::mangle(clang::GlobalDecl)
(/home/david/llvm/build/bin/clang+++0x4861348)
#16 0x00005570cc076b0e (anonymous
namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::GlobalDecl,
llvm::raw_ostream&) (/home/david/llvm/build/bin/clang+++0x485eb0e)
#17 0x00005570c98cecc0
getMangledNameImpl[abi:cxx11](clang::CodeGen::CodeGenModule const&,
clang::GlobalDecl, clang::NamedDecl const*, bool)
(/home/david/llvm/build/bin/clang+++0x20b6cc0)
#18 0x00005570c98c8314
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
(/home/david/llvm/build/bin/clang+++0x20b0314)
#19 0x00005570c98e087b
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t)
(/home/david/llvm/build/bin/clang+++0x20c887b)
#20 0x00005570c9ad3e16 EmitFunctionDeclPointer(clang::CodeGen::CodeGenModule&,
clang::GlobalDecl) (/home/david/llvm/build/bin/clang+++0x22bbe16)
#21 0x00005570c9ad25fa EmitDirectCallee(clang::CodeGen::CodeGenFunction&,
clang::GlobalDecl) (/home/david/llvm/build/bin/clang+++0x22ba5fa)
#22 0x00005570c9ad1208 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*) (/home/david/llvm/build/bin/clang+++0x22b9208)
#23 0x00005570c9ad0fc2 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*) (/home/david/llvm/build/bin/clang+++0x22b8fc2)
#24 0x00005570c9ad0d14
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) (/home/david/llvm/build/bin/clang+++0x22b8d14)
#25 0x00005570c9adebbb clang::CodeGen::RValue
llvm::function_ref<clang::CodeGen::RValue
(clang::CodeGen::ReturnValueSlot)>::callback_fn<(anonymous
namespace)::AggExprEmitter::VisitCallExpr(clang::CallExpr const*)::$_0>(long,
clang::CodeGen::ReturnValueSlot) (/home/david/llvm/build/bin/clang+++0x22c6bbb)
#26 0x00005570c9ade933 (anonymous
namespace)::AggExprEmitter::withReturnValueSlot(clang::Expr const*,
llvm::function_ref<clang::CodeGen::RValue (clang::CodeGen::ReturnValueSlot)>)
(/home/david/llvm/build/bin/clang+++0x22c6933)
#27 0x00005570c9ada720 (anonymous
namespace)::AggExprEmitter::VisitCallExpr(clang::CallExpr const*)
(/home/david/llvm/build/bin/clang+++0x22c2720)
#28 0x00005570c9ad6cf4 clang::StmtVisitorBase<std::add_pointer, (anonymous
namespace)::AggExprEmitter, void>::Visit(clang::Stmt*)
(/home/david/llvm/build/bin/clang+++0x22becf4)
#29 0x00005570c9ad4d49 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot)
(/home/david/llvm/build/bin/clang+++0x22bcd49)
#30 0x00005570c9ab405a clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/home/david/llvm/build/bin/clang+++0x229c05a)
#31 0x00005570c9ab3e89
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/home/david/llvm/build/bin/clang+++0x229be89)
#32 0x00005570c985c104 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/home/david/llvm/build/bin/clang+++0x2044104)
#33 0x00005570c9866440
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/home/david/llvm/build/bin/clang+++0x204e440)
#34 0x00005570c98bece1
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/home/david/llvm/build/bin/clang+++0x20a6ce1)
#35 0x00005570c98de2e4
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/david/llvm/build/bin/clang+++0x20c62e4)
#36 0x00005570c98d6f54
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/home/david/llvm/build/bin/clang+++0x20bef54)
#37 0x00005570c98db223
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/home/david/llvm/build/bin/clang+++0x20c3223)
#38 0x00005570c98e2522
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(/home/david/llvm/build/bin/clang+++0x20ca522)
#39 0x00005570ca45a720 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/david/llvm/build/bin/clang+++0x2c42720)
#40 0x00005570ca45711c
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/david/llvm/build/bin/clang+++0x2c3f11c)
#41 0x00005570cb2f3414 clang::ParseAST(clang::Sema&, bool, bool)
(/home/david/llvm/build/bin/clang+++0x3adb414)
#42 0x00005570ca455c03 clang::CodeGenAction::ExecuteAction()
(/home/david/llvm/build/bin/clang+++0x2c3dc03)
#43 0x00005570c9e05084 clang::FrontendAction::Execute()
(/home/david/llvm/build/bin/clang+++0x25ed084)
#44 0x00005570c9d95b43
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/david/llvm/build/bin/clang+++0x257db43)
#45 0x00005570c9eb91f6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/david/llvm/build/bin/clang+++0x26a11f6)
#46 0x00005570c849817c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/david/llvm/build/bin/clang+++0xc8017c)
#47 0x00005570c849625d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/david/llvm/build/bin/clang+++0xc7e25d)
#48 0x00005570c9c40b22 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1>(long)
(/home/david/llvm/build/bin/clang+++0x2428b22)
#49 0x00005570c9540d01
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/david/llvm/build/bin/clang+++0x1d28d01)
#50 0x00005570c9c40271
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/home/david/llvm/build/bin/clang+++0x2428271)
#51 0x00005570c9c0d06b
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/david/llvm/build/bin/clang+++0x23f506b)
#52 0x00005570c9c0d4aa
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/david/llvm/build/bin/clang+++0x23f54aa)
#53 0x00005570c9c25cb7
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/david/llvm/build/bin/clang+++0x240dcb7)
#54 0x00005570c8495b6b main (/home/david/llvm/build/bin/clang+++0xc7db6b)
#55 0x00007f244152c152 __libc_start_main (/usr/lib/libc.so.6+0x28152)
#56 0x00005570c8492e2e _start (/home/david/llvm/build/bin/clang+++0xc7ae2e)
clang-12: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
5c0a2356995fa89b1692a3ddca36e305c640786a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/david/llvm/build/bin
clang-12: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12: note: diagnostic msg: /tmp/integer-e2c8cb.cpp
clang-12: note: diagnostic msg: /tmp/integer-e2c8cb.sh
clang-12: note: diagnostic msg: 

********************
```

This is a recent failure, a build from a week or two ago passes.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201016/d7c202a0/attachment-0001.html>


More information about the llvm-bugs mailing list