[LLVMbugs] [Bug 20910] New: Assertion failure for nested capture of a C++ reference type in a Block expression nested in a C++11 lambda expression

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 11 11:19:08 PDT 2014


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

            Bug ID: 20910
           Summary: Assertion failure for nested capture of a C++
                    reference type in a Block expression nested in a C++11
                    lambda expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: thonermann at coverity.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang 3.4, 3.5, and trunk (r217266) encounter an assertion failure compiling
the following test case.  The diagnostics below were produced using Clang 3.4
(my Clang 3.5 and trunk builds don't resolve symbols in back traces for some
reason).

$ cat t.cpp
void f(int i) {
    int &ri = i;
    [ri]{
        ^{ ri; };
    }();
}

$ clang++ -fblocks -std=c++11 t.cpp -lBlocksRuntime
...
clang: /lib/Serialization/../../include/clang/AST/Expr.h:134: void
clang::Expr::setType(clang::QualType): Assertion `(t.isNull() ||
!t->isReferenceType()) && "Expressions can't have reference type"' failed.
0  clang           0x000000000338d77b llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  clang           0x000000000338da02
2  clang           0x000000000338d446
3  libpthread.so.0 0x00007f16ee2c1cb0
4  libc.so.6       0x00007f16ed2eb425 gsignal + 53
5  libc.so.6       0x00007f16ed2eeb8b abort + 379
6  libc.so.6       0x00007f16ed2e40ee
7  libc.so.6       0x00007f16ed2e4192
8  clang           0x0000000000f2ebbe
9  clang           0x00000000010c7a9d
10 clang           0x00000000010c7afc
11 clang           0x00000000010bdace
clang::CodeGen::CodeGenFunction::EmitBlockLiteral(clang::CodeGen::CGBlockInfo
const&) + 2100
12 clang           0x00000000010bd27d
clang::CodeGen::CodeGenFunction::EmitBlockLiteral(clang::BlockExpr const*) +
391
13 clang           0x00000000011524a0
14 clang           0x00000000011539a3
15 clang           0x0000000001142ce7
16 clang           0x0000000001143c63
17 clang           0x0000000001153d63
18 clang           0x0000000001142ce7
19 clang           0x0000000001152989
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 159
20 clang           0x000000000110a9d1
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) + 101
21 clang           0x000000000110a921
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 127
22 clang           0x000000000100c0a6
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 400
23 clang           0x000000000100c74d
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 109
24 clang           0x000000000102d697
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 113
25 clang           0x000000000102ddcb
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1347
26 clang           0x000000000103ff0f
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 1051
27 clang           0x000000000103d36d
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 331
28 clang           0x000000000103be19
clang::CodeGen::CodeGenModule::EmitDeferred() + 341
29 clang           0x0000000001038df9 clang::CodeGen::CodeGenModule::Release()
+ 25
30 clang           0x0000000000fc184d
31 clang           0x0000000000fc02ff
32 clang           0x00000000011cfb08 clang::ParseAST(clang::Sema&, bool, bool)
+ 776
33 clang           0x0000000000d6b0ab clang::ASTFrontendAction::ExecuteAction()
+ 321
34 clang           0x0000000000fbfa54 clang::CodeGenAction::ExecuteAction() +
1414
35 clang           0x0000000000d6abea clang::FrontendAction::Execute() + 200
36 clang           0x0000000000d3c21c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 720
37 clang           0x0000000000d0ab3a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1018
38 clang           0x0000000000cfb96d cc1_main(char const**, char const**, char
const*, void*) + 717
39 clang           0x0000000000d0620a main + 786
40 libc.so.6       0x00007f16ed2d676d __libc_start_main + 237
41 clang           0x0000000000cfb069
Stack dump:
0.      Program arguments:
/nfs/thonermann/products/linux-x86/clang-3.4/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
t.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
/nfs/thonermann/products/linux-x86/clang-3.4/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
/nfs/thonermann/products/linux-x86/clang-3.4/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
/data00/home/thonermann/prevent-blocks/tmp/bug9 -ferror-limit 19
-fmessage-length 197 -mstackrealign -fblocks -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -o /tmp/t-0b75f4.o -x c++ t.cpp 
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      t.cpp:3:5: Generating code for declaration 'f(int)::<anonymous
class>::operator()'
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 (tags/RELEASE_34/final)
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/20140911/59d9f1c0/attachment.html>


More information about the llvm-bugs mailing list