[LLVMbugs] [Bug 13314] New: "Assertion failed: (isa<BlockDecl>(CurCodeDecl) && E->refersToEnclosingLocal()), function EmitDeclRefLValue" when a block refers to a C++ object in a closure

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 9 15:11:25 PDT 2012


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

             Bug #: 13314
           Summary: "Assertion failed: (isa<BlockDecl>(CurCodeDecl) &&
                    E->refersToEnclosingLocal()), function
                    EmitDeclRefLValue" when a block refers to a C++ object
                    in a closure
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


noname:delta thakis$ cat repro.mii
class Foo { };

void f() {
  Foo foo;
  ^() {
    return foo;
  };
}
noname:delta thakis$ ~/src/llvm/Release+Asserts/bin/clang -c repro.mii
repro.mii:5:3: warning: expression result unused [-Wunused-value]
  ^() {
  ^~~~~
Assertion failed: (isa<BlockDecl>(CurCodeDecl) && E->refersToEnclosingLocal()),
function EmitDeclRefLValue, file CGExpr.cpp, line 1605.
0  clang             0x000000010299b112 _ZL15PrintStackTracePv + 34
1  clang             0x000000010299b5f9 _ZL13SignalHandleri + 649
2  libsystem_c.dylib 0x00007fff905fccfa _sigtramp + 26
3  libsystem_c.dylib 0x00007fff61050438 _sigtramp + 18446744072915072856
4  clang             0x000000010299b356 abort + 22
5  clang             0x000000010299b315 __assert_rtn + 53
6  clang             0x0000000101600290
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) +
2128
7  clang             0x00000001015fc65f
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 383
8  clang             0x000000010160f7f0 (anonymous
namespace)::AggExprEmitter::EmitAggLoadOfLValue(clang::Expr const*) + 32
9  clang             0x000000010160e5fc clang::StmtVisitorBase<clang::make_ptr,
(anonymous namespace)::AggExprEmitter, void>::Visit(clang::Stmt*) + 7292
10 clang             0x000000010161171a (anonymous
namespace)::AggExprEmitter::VisitCastExpr(clang::CastExpr*) + 698
11 clang             0x000000010160d2d9 clang::StmtVisitorBase<clang::make_ptr,
(anonymous namespace)::AggExprEmitter, void>::Visit(clang::Stmt*) + 2393
12 clang             0x000000010160c8ee
clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot) + 478
13 clang             0x00000001015f14f5
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 725
14 clang             0x00000001015adb51
clang::CodeGen::CodeGenFunction::EmitBlockLiteral(clang::CodeGen::CGBlockInfo
const&) + 1489
15 clang             0x00000001015ac4d8
clang::CodeGen::CodeGenFunction::EmitBlockLiteral(clang::BlockExpr const*) +
328
16 clang             0x000000010162d40b clang::StmtVisitorBase<clang::make_ptr,
(anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) +
14523
17 clang             0x000000010162d928 clang::StmtVisitorBase<clang::make_ptr,
(anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) +
15832
18 clang             0x0000000101624ac0
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 96
19 clang             0x00000001015fc3ac
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) + 60
20 clang             0x00000001015fc359
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 41
21 clang             0x0000000101679857
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 391
22 clang             0x000000010167e7eb
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot) + 235
23 clang             0x0000000101679c9d
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 125
24 clang             0x00000001016796f9
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 41
25 clang             0x000000010168a7a6
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 854
26 clang             0x0000000101693030
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 2064
27 clang             0x0000000101690909
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 377
28 clang             0x0000000101691fc5
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1509
29 clang             0x000000010169762a
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 282
30 clang             0x00000001016b1f3f (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 127
31 clang             0x0000000101687c4a
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 170
32 clang             0x00000001016bd653 clang::ParseAST(clang::Sema&, bool,
bool) + 323
33 clang             0x0000000101686fe9 clang::CodeGenAction::ExecuteAction() +
1257
34 clang             0x000000010149d88b clang::FrontendAction::Execute() + 107
35 clang             0x000000010147e83f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 991
36 clang             0x0000000101465820
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3184
37 clang             0x000000010145cabd cc1_main(char const**, char const**,
char const*, void*) + 5501
38 clang             0x0000000101461ba7 main + 663
39 clang             0x000000010145b534 start + 52
40 clang             0x000000000000002e start + 18446744069393238830
Stack dump:
0.    Program arguments: /Users/thakis/src/llvm/Release+Asserts/bin/clang -cc1
-triple x86_64-apple-macosx10.7.0 -emit-obj -mrelax-all -disable-free
-main-file-name repro.mii -pic-level 2 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 128.2 -coverage-file
repro.o -resource-dir
/Users/thakis/src/llvm/Release+Asserts/bin/../lib/clang/3.2 -fdeprecated-macro
-fdebug-compilation-dir /Users/thakis/src/delta -ferror-limit 19
-fmessage-length 224 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.7.0 -fobjc-dispatch-method=mixed
-fobjc-default-synthesize-properties -fobjc-exceptions -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o repro.o -x
objective-c++-cpp-output repro.mii 
1.    <eof> parser at end of file
2.    repro.mii:3:6: LLVM IR generation of declaration 'f'
3.    repro.mii:3:6: Generating code for declaration 'f'
4.    repro.mii:3:10: LLVM IR generation of compound statement ('{}')
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (trunk 159934)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.
noname:delta thakis$ ~/src/llvm/Release+Asserts/bin/clang --version
clang version 3.2 (trunk 159934)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list