[LLVMbugs] [Bug 6468] New: 97592: -fblocks codegen with template reference arg crash

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 2 14:00:51 PST 2010


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

           Summary: 97592:  -fblocks codegen with  template reference arg
                    crash
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P5
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: raila at illinois.edu
                CC: llvmbugs at cs.uiuc.edu


The following snippet crashes with arg type template reference, but works
without arg type template reference:
#include <stdio.h>
#include <stddef.h>

template<typename T>
class range {
public:
T _i;
        range(T i) {_i = i;};
        T get() {return _i;};
};

int main() {

        // works
        void (^bl)(range<int> ) = ^(range<int> i){printf("Hello Blocks %d\n",
i.get()); };

        //crashes in godegen?
        void (^bl2)(range<int>& ) = ^(range<int>& i){printf("Hello Blocks
%d\n", i.get()); };

        return 0;
}



Here is the backtrace:
clang: ASTContext.cpp:3805: void
clang::ASTContext::getObjCEncodingForTypeImpl(clang::QualType, std::string&,
bool, bool, const clang::FieldDecl*, bool, bool): Assertion `0 && "@encode for
type not implemented!"' failed.

Program received signal SIGABRT, Aborted.
0x00000039410326c5 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00000039410326c5 in raise () from /lib64/libc.so.6
#1  0x0000003941033ea5 in abort () from /lib64/libc.so.6
#2  0x000000394102b7b5 in __assert_fail () from /lib64/libc.so.6
#3  0x0000000000931aec in clang::ASTContext::getObjCEncodingForTypeImpl
(this=0x20fc3a0, T=..., S="v16@?0", ExpandPointedToStructures=true, 
    ExpandStructures=true, FD=0x0, OutermostType=true, EncodingProperty=false)
at ASTContext.cpp:3805
#4  0x000000000093059f in clang::ASTContext::getObjCEncodingForType
(this=0x20fc3a0, T=..., S="v16@?0", Field=0x0) at ASTContext.cpp:3510
#5  0x000000000092fb73 in clang::ASTContext::getObjCEncodingForBlock
(this=0x20fc3a0, Expr=0x218ee50, S="v16@?0") at ASTContext.cpp:3314
#6  0x0000000000661939 in
clang::CodeGen::CodeGenFunction::BuildDescriptorBlockDecl (this=0x7fffffffb4f0,
BE=0x218ee50, 
    BlockHasCopyDispose=false, Size=..., Ty=0x0, NoteForHelper=0x0) at
CGBlocks.cpp:57
#7  0x00000000006621b2 in clang::CodeGen::CodeGenFunction::BuildBlockLiteralTmp
(this=0x7fffffffb4f0, BE=0x218ee50) at CGBlocks.cpp:199
#8  0x00000000005edce6 in (anonymous
namespace)::ScalarExprEmitter::VisitBlockExpr (this=0x7fffffffa460,
BE=0x218ee50)
    at CGExprScalar.cpp:1841
#9  0x00000000005ef0f8 in clang::StmtVisitor<<unnamed>::ScalarExprEmitter,
llvm::Value*>::Visit(clang::Stmt *) (this=0x7fffffffa460, 
    S=0x218ee50) at
/home/raila/dpc++/clang/llvm/tools/clang/lib/CodeGen/../../include/clang/AST/StmtNodes.def:152
#10 0x00000000005edd47 in clang::CodeGen::CodeGenFunction::EmitScalarExpr
(this=0x7fffffffb4f0, E=0x218ee50, IgnoreResultAssign=false)
    at CGExprScalar.cpp:1855
#11 0x00000000005b350d in
clang::CodeGen::CodeGenFunction::EmitLocalBlockVarDecl (this=0x7fffffffb4f0,
D=...) at CGDecl.cpp:527
#12 0x00000000005b14c7 in clang::CodeGen::CodeGenFunction::EmitBlockVarDecl
(this=0x7fffffffb4f0, D=...) at CGDecl.cpp:78
#13 0x00000000005b13be in clang::CodeGen::CodeGenFunction::EmitDecl
(this=0x7fffffffb4f0, D=...) at CGDecl.cpp:55
#14 0x000000000062d69b in clang::CodeGen::CodeGenFunction::EmitDeclStmt
(this=0x7fffffffb4f0, S=...) at CGStmt.cpp:632
#15 0x000000000062bd0a in clang::CodeGen::CodeGenFunction::EmitSimpleStmt
(this=0x7fffffffb4f0, S=0x218ee80) at CGStmt.cpp:129
#16 0x000000000062b8b8 in clang::CodeGen::CodeGenFunction::EmitStmt
(this=0x7fffffffb4f0, S=0x218ee80) at CGStmt.cpp:43
#17 0x000000000062bf2d in clang::CodeGen::CodeGenFunction::EmitCompoundStmt
(this=0x7fffffffb4f0, S=..., GetLast=false, AggLoc=0x0, 
    isAggVol=false) at CGStmt.cpp:160
#18 0x000000000062bce7 in clang::CodeGen::CodeGenFunction::EmitSimpleStmt
(this=0x7fffffffb4f0, S=0x218ef00) at CGStmt.cpp:128
#19 0x000000000062b8b8 in clang::CodeGen::CodeGenFunction::EmitStmt
(this=0x7fffffffb4f0, S=0x218ef00) at CGStmt.cpp:43
#20 0x000000000065b9c9 in clang::CodeGen::CodeGenFunction::EmitFunctionBody
(this=0x7fffffffb4f0, Args=...) at CodeGenFunction.cpp:252
#21 0x000000000065c05c in clang::CodeGen::CodeGenFunction::GenerateCode
(this=0x7fffffffb4f0, GD=..., Fn=0x2146fa0)
    at CodeGenFunction.cpp:314
#22 0x000000000055ad86 in
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition (this=0x21194b0,
GD=...) at CodeGenModule.cpp:1259
#23 0x0000000000558fb5 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition
(this=0x21194b0, GD=...) at CodeGenModule.cpp:690
#24 0x0000000000558d30 in clang::CodeGen::CodeGenModule::EmitGlobal
(this=0x21194b0, GD=...) at CodeGenModule.cpp:661
#25 0x000000000055c901 in clang::CodeGen::CodeGenModule::EmitTopLevelDecl
(this=0x21194b0, D=0x218bc30) at CodeGenModule.cpp:1704
#26 0x0000000000555e0d in (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl (this=0x20fe450, DG=...) at
ModuleBuilder.cpp:65
#27 0x0000000000418a1e in (anonymous
namespace)::BackendConsumer::HandleTopLevelDecl (this=0x21052d0, D=...) at
CodeGenAction.cpp:142
#28 0x0000000000672ee3 in clang::ParseAST (PP=..., Consumer=0x21052d0, Ctx=...,
PrintStats=false, CompleteTranslationUnit=true, 
    CompletionConsumer=0x0) at ParseAST.cpp:72
#29 0x0000000000433d92 in clang::ASTFrontendAction::ExecuteAction
(this=0x20eefa0) at FrontendAction.cpp:219
#30 0x0000000000433a20 in clang::FrontendAction::Execute (this=0x20eefa0) at
FrontendAction.cpp:149
#31 0x000000000041e0bc in clang::CompilerInstance::ExecuteAction
(this=0x7fffffffd7e0, Act=...) at CompilerInstance.cpp:509
#32 0x0000000000408446 in cc1_main (ArgBegin=0x7fffffffe0e8,
ArgEnd=0x7fffffffe1d0, 
    Argv0=0x7fffffffe45c "/home/raila/dpc++/clang/llvm/Debug/bin/clang",
MainAddr=0x40c0dc) at cc1_main.cpp:268
#33 0x000000000040cfbe in main (argc=31, argv=0x7fffffffe0d8) at driver.cpp:179

-- 
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