<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - crash in PrintStackTrace when compiling a lambda returning an unknown type"
href="https://llvm.org/bugs/show_bug.cgi?id=28501">28501</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>crash in PrintStackTrace when compiling a lambda returning an unknown type
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</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>normal
</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>blastrock@free.fr
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This simple program should not compile, but it makes the compiler crash:
auto l = [] {
return NoType{};
return NoType{};
};
Compile with
clang++ -std=c++14 tsts.cpp -c
Here is the output on clang 3.8:
tsts.cpp:2:10: error: use of undeclared identifier 'NoType'
return NoType{};
^
#0 0x0000000000e65978 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/philippe/.local/bin/clang-3.8+0xe65978)
#1 0x0000000000e643c6 llvm::sys::RunSignalHandlers()
(/home/philippe/.local/bin/clang-3.8+0xe643c6)
#2 0x0000000000e66415 SignalHandler(int)
(/home/philippe/.local/bin/clang-3.8+0xe66415)
#3 0x00007f59e3ffbd40 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10d40)
#4 0x0000000001fc5017
clang::ASTContext::getCanonicalFunctionResultType(clang::QualType) const
(/home/philippe/.local/bin/clang-3.8+0x1fc5017)
#5 0x0000000001caf49f
clang::Sema::DeduceFunctionTypeFromReturnExpr(clang::FunctionDecl*,
clang::SourceLocation, clang::Expr*&, clang::AutoType*)
(/home/philippe/.local/bin/clang-3.8+0x1caf49f)
#6 0x0000000001cae9bb
clang::Sema::ActOnCapScopeReturnStmt(clang::SourceLocation, clang::Expr*)
(/home/philippe/.local/bin/clang-3.8+0x1cae9bb)
#7 0x0000000001cb0115 clang::Sema::ActOnReturnStmt(clang::SourceLocation,
clang::Expr*, clang::Scope*) (/home/philippe/.local/bin/clang-3.8+0x1cb0115)
#8 0x0000000001839126 clang::Parser::ParseReturnStatement()
(/home/philippe/.local/bin/clang-3.8+0x1839126)
#9 0x0000000001834961
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/home/philippe/.local/bin/clang-3.8+0x1834961)
#10 0x0000000001833c11
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/home/philippe/.local/bin/clang-3.8+0x1833c11)
#11 0x000000000183a984 clang::Parser::ParseCompoundStatementBody(bool)
(/home/philippe/.local/bin/clang-3.8+0x183a984)
#12 0x000000000180eac4
clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&)
(/home/philippe/.local/bin/clang-3.8+0x180eac4)
#13 0x000000000180ce7a clang::Parser::ParseLambdaExpression()
(/home/philippe/.local/bin/clang-3.8+0x180ce7a)
#14 0x00000000017fdf57 clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState) (/home/philippe/.local/bin/clang-3.8+0x17fdf57)
#15 0x00000000017fa2ac
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/home/philippe/.local/bin/clang-3.8+0x17fa2ac)
#16 0x00000000017d8aad
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/home/philippe/.local/bin/clang-3.8+0x17d8aad)
#17 0x00000000017d6689 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/home/philippe/.local/bin/clang-3.8+0x17d6689)
#18 0x00000000017c143d
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/philippe/.local/bin/clang-3.8+0x17c143d)
#19 0x00000000017c0e28
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/home/philippe/.local/bin/clang-3.8+0x17c0e28)
#20 0x00000000017c03cf
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/home/philippe/.local/bin/clang-3.8+0x17c03cf)
#21 0x00000000017bf655
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/philippe/.local/bin/clang-3.8+0x17bf655)
#22 0x00000000017bc011 clang::ParseAST(clang::Sema&, bool, bool)
(/home/philippe/.local/bin/clang-3.8+0x17bc011)
#23 0x00000000012309dc clang::FrontendAction::Execute()
(/home/philippe/.local/bin/clang-3.8+0x12309dc)
#24 0x0000000001200828
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/philippe/.local/bin/clang-3.8+0x1200828)
#25 0x00000000012a0d9d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/philippe/.local/bin/clang-3.8+0x12a0d9d)
#26 0x00000000006ab29a cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/philippe/.local/bin/clang-3.8+0x6ab29a)
#27 0x00000000006aa530 main (/home/philippe/.local/bin/clang-3.8+0x6aa530)
#28 0x00007f59e31b85f0 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x205f0)
#29 0x00000000006a7669 _start (/home/philippe/.local/bin/clang-3.8+0x6a7669)
Stack dump:
0. Program arguments: /home/philippe/.local/bin/clang-3.8 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name tsts.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 -debugger-tuning=gdb -coverage-file /tmp/tsts.cpp
-resource-dir /home/philippe/.local/bin/../lib/clang/3.8.0 -c-isystem
/home/philippe/.usr/include -c-isystem /home/philippe/.arch/include
-cxx-isystem /home/philippe/.usr/include -cxx-isystem
/home/philippe/.arch/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1/backward
-internal-isystem /usr/local/include -internal-isystem
/home/philippe/.local/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 136
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o tsts.o -x c++ tsts.cpp
1. tsts.cpp:3:16: current parser token '{'
2. tsts.cpp:1:10: lambda expression parsing
3. tsts.cpp:1:13: in compound statement ('{}')
clang-3.8: error: unable to execute command: Segmentation fault (core dumped)
clang-3.8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/philippe/.local/bin
clang-3.8: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.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-3.8: note: diagnostic msg: /tmp/tsts-6df5af.cpp
clang-3.8: note: diagnostic msg: /tmp/tsts-6df5af.sh
clang-3.8: note: diagnostic msg:
********************
In case it is useful, here is the contents of the run script:
# Crash reproducer for clang version 3.8.0
# Driver args: "--driver-mode=g++" "-std=c++14" "tsts.cpp" "-c"
# Original command: "/home/philippe/.local/bin/clang-3.8" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-disable-llvm-verifier" "-main-file-name" "tsts.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" "-debugger-tuning=gdb"
"-coverage-file" "/tmp/tsts.cpp" "-resource-dir"
"/home/philippe/.local/bin/../lib/clang/3.8.0" "-c-isystem"
"/home/philippe/.usr/include" "-c-isystem" "/home/philippe/.arch/include"
"-cxx-isystem" "/home/philippe/.usr/include" "-cxx-isystem"
"/home/philippe/.arch/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/home/philippe/.local/bin/../lib/clang/3.8.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-std=c++14" "-fdeprecated-macro" "-fdebug-compilation-dir"
"/tmp" "-ferror-limit" "19" "-fmessage-length" "136" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-o" "tsts.o" "-x" "c++" "tsts.cpp"
"/home/philippe/.local/bin/clang-3.8" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-disable-llvm-verifier" "-main-file-name" "tsts.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" "-debugger-tuning=gdb" "-c-isystem"
"/home/philippe/.usr/include" "-c-isystem" "/home/philippe/.arch/include"
"-cxx-isystem" "/home/philippe/.usr/include" "-cxx-isystem"
"/home/philippe/.arch/include" "-std=c++14" "-fdeprecated-macro"
"-ferror-limit" "19" "-fmessage-length" "136" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-x" "c++" "tsts-6df5af.cpp"</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>