<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Lambda in template parameter list compiler segmentation fault (ICE)"
href="https://bugs.llvm.org/show_bug.cgi?id=40105">40105</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Lambda in template parameter list compiler segmentation fault (ICE)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vittorio.romeo@outlook.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The following code
template<int = []{ return 0; }()>
void f() { }
int main() { f(); }
produces this segmentation fault on clang version 8.0.0 (trunk 349594):
Stack dump:
0. Program arguments:
/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8 -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name example.cpp -mrelocation-model static
-mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -debug-info-kind=limited -dwarf-version=4
-debugger-tuning=gdb -coverage-notes-file
/tmp/compiler-explorer-compiler1181119-60-125pr78.i7ujh/output.gcno
-resource-dir /opt/compiler-explorer/clang-trunk-20181219/lib/clang/8.0.0
-internal-isystem
/opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0
-internal-isystem
/opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0/x86_64-linux-gnu
-internal-isystem
/opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/opt/compiler-explorer/clang-trunk-20181219/lib/clang/8.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall
-std=c++2a -fdeprecated-macro -fdebug-compilation-dir
/tmp/compiler-explorer-compiler1181119-60-125pr78.i7ujh -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -mllvm --x86-asm-syntax=intel -o
/tmp/compiler-explorer-compiler1181119-60-125pr78.i7ujh/output.s -x c++
<source> -faddrsig
1. <eof> parser at end of file
2. <source>:4:9: LLVM IR generation of declaration 'main'
3. <source>:4:9: Generating code for declaration 'main'
4. <source>:2:10: Mangling declaration 'f'
#0 0x000055ab122e94da llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x23fc4da)
#1 0x000055ab122e7474 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x23fa474)
#2 0x000055ab122e75b2 SignalHandler(int)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x23fa5b2)
#3 0x00007f808de00890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x000055ab13fedda8 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x4100da8)
#5 0x000055ab13fed1bd (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned int)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x41001bd)
#6 0x000055ab13ff2f53 (anonymous
namespace)::CXXNameMangler::mangleTemplateArg(clang::TemplateArgument)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x4105f53)
#7 0x000055ab13ff31df (anonymous
namespace)::CXXNameMangler::mangleTemplateArgs(clang::TemplateArgumentList
const&) (/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x41061df)
#8 0x000055ab13ff54fb (anonymous
namespace)::CXXNameMangler::mangleNameWithAbiTags(clang::NamedDecl const*,
llvm::SmallVector<llvm::StringRef, 4u> const*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x41084fb)
#9 0x000055ab13fea9c2 (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding(clang::FunctionDecl const*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x40fd9c2)
#10 0x000055ab13fec496 (anonymous
namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::NamedDecl const*,
llvm::raw_ostream&)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x40ff496)
#11 0x000055ab1257c77c getMangledNameImpl(clang::CodeGen::CodeGenModule
const&, clang::GlobalDecl, clang::NamedDecl const*, bool)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x268f77c)
#12 0x000055ab1259162e
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x26a462e)
#13 0x000055ab125c528b
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x26d828b)
#14 0x000055ab1270dd33
EmitFunctionDeclPointer(clang::CodeGen::CodeGenModule&, clang::FunctionDecl
const*) (/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x2820d33)
#15 0x000055ab12728414
clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr const*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x283b414)
#16 0x000055ab127284c1
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x283b4c1)
#17 0x000055ab1275d289 (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x2870289)
#18 0x000055ab1275a9db (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x286d9db)
#19 0x000055ab1275cc30
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x286fc30)
#20 0x000055ab127103ff
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x28233ff)
#21 0x000055ab1272090e
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x283390e)
#22 0x000055ab1252fa23
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*,
llvm::ArrayRef<clang::Attr const*>)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x2642a23)
#23 0x000055ab1252ffa3
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x2642fa3)
#24 0x000055ab1256abf1
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x267dbf1)
#25 0x000055ab1257320e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x268620e)
#26 0x000055ab125c5669
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x26d8669)
#27 0x000055ab125c2f75
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x26d5f75)
#28 0x000055ab125c3743
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x26d6743)
#29 0x000055ab125c8a27
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.5847)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x26dba27)
#30 0x000055ab12f30c51 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x3043c51)
#31 0x000055ab12f26806
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x3039806)
#32 0x000055ab136b5914 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x37c8914)
#33 0x000055ab12f2e5a7 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x30415a7)
#34 0x000055ab12977846 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x2a8a846)
#35 0x000055ab1293a00c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x2a4d00c)
#36 0x000055ab12a3011b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0x2b4311b)
#37 0x000055ab109d3388 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0xae6388)
#38 0x000055ab109189a9 main
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0xa2b9a9)
#39 0x00007f808ccbeb97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#40 0x000055ab109d061a _start
(/opt/compiler-explorer/clang-trunk-20181219/bin/clang-8+0xae361a)
clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.0 (trunk 349594)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-trunk/bin
clang-8: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang-8: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-8: note: diagnostic msg: /tmp/example-a437e2.cpp
clang-8: note: diagnostic msg: /tmp/example-a437e2.sh
clang-8: note: diagnostic msg:
********************
Compiler returned: 254
Live example on godbolt.org:
<a href="https://gcc.godbolt.org/z/fbS_dd">https://gcc.godbolt.org/z/fbS_dd</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>