[LLVMbugs] [Bug 17675] New: Using declval on a lambda in trailing return type crashes compiler

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 24 03:25:10 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17675

            Bug ID: 17675
           Summary: Using declval on a lambda in trailing return type
                    crashes compiler
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: adam.antonik at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This is nonsense code, but causes a crash:
#include <utility>
template <class A> auto a(A) -> decltype(std::declval<[](){}>) {}
int main() {a(0);}

Backtrace:


non-canonical or dependent type in IR-generation
UNREACHABLE executed at
/home/adam/llvm/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:93!
0  libLLVM-3.4svn.so 0x00007fe4bbbafe65 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  libLLVM-3.4svn.so 0x00007fe4bbbb02b3
2  libpthread.so.0   0x00007fe4bace3cb0
3  libc.so.6         0x00007fe4b9b05425 gsignal + 53
4  libc.so.6         0x00007fe4b9b08b8b abort + 379
5  libLLVM-3.4svn.so 0x00007fe4bbb9d9d8 llvm::llvm_unreachable_internal(char
const*, char const*, unsigned int) + 440
6  clang             0x000000000073d807
clang::CodeGen::CodeGenFunction::getEvaluationKind(clang::QualType) + 183
7  clang             0x00000000007cbd54
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) + 36
8  clang             0x00000000007cbd29
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 57
9  clang             0x000000000072d0aa
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 266
10 clang             0x00000000007335cb
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 91
11 clang             0x0000000000740c9f
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 783
12 clang             0x000000000074b9d2
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 674
13 clang             0x000000000074916f
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 239
14 clang             0x000000000074ac87
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 791
15 clang             0x000000000074d612
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 1202
16 clang             0x00000000006ff1af
17 clang             0x00000000006fe5b6
18 clang             0x0000000000865353 clang::ParseAST(clang::Sema&, bool,
bool) + 435
19 clang             0x00000000006fdce2 clang::CodeGenAction::ExecuteAction() +
514
20 clang             0x0000000000579b01 clang::FrontendAction::Execute() + 113
21 clang             0x000000000055745d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 909
22 clang             0x000000000053e095
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3029
23 clang             0x0000000000535d69 cc1_main(char const**, char const**,
char const*, void*) + 569
24 clang             0x000000000053c055 main + 8517
25 libc.so.6         0x00007fe4b9af076d __libc_start_main + 237
26 clang             0x0000000000535a6d
Stack dump:
0.      Program arguments:
/home/adam/llvm/build/Release+Debug+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
cpp11.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-target-linker-version 2.22 -resource-dir
/home/adam/llvm/build/Release+Debug+Asserts/bin/../lib/clang/3.4
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/x86_64-linux-gnu/c++/4.6
-internal-isystem /usr/local/include -internal-isystem
/home/adam/llvm/build/Release+Debug+Asserts/bin/../lib/clang/3.4/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/adam/test
-ferror-limit 19 -fmessage-length 363 -mstackrealign -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -o /tmp/cpp11-0bd6a7.o -x c++ cpp11.cpp 
1.      <eof> parser at end of file
2.      cpp11.cpp:3:5: LLVM IR generation of declaration 'main'
3.      cpp11.cpp:3:5: Generating code for declaration 'main'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (trunk 192895) (llvm/trunk 192886)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
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/20131024/6b65d1ef/attachment.html>


More information about the llvm-bugs mailing list