[LLVMbugs] [Bug 13117] New: Clang accepts ill-formed C++11 code, leads to crash later

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 15 08:30:49 PDT 2012


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

             Bug #: 13117
           Summary: Clang accepts ill-formed C++11 code, leads to crash
                    later
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: andersca at mac.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


When trying to compile

struct A {
    template<typename ... Args> static void f()
    {
        void (^block)(id, Args...) = ^(Args args) {
        };
    }
};

void g() {
    A::f<int, int>();
}

clang crashes:


0  clang             0x000000010ae235a2 _ZL15PrintStackTracePv + 34
1  clang             0x000000010ae23a29 _ZL13SignalHandleri + 553
2  libsystem_c.dylib 0x00007fff90dddcfa _sigtramp + 26
3  libsystem_c.dylib 0x00007fff90ddb789 free + 194
4  clang             0x000000010a6ba2b7
clang::CodeGen::CodeGenFunction::GenerateBlockFunction(clang::GlobalDecl,
clang::CodeGen::CGBlockInfo const&, clang::Decl const*,
llvm::DenseMap<clang::Decl const*, llvm::Value*, llvm::DenseMapInfo<clang::Decl
const*>, llvm::DenseMapInfo<llvm::Value*> > const&) + 1271
5  clang             0x000000010a6b934b
clang::CodeGen::CodeGenFunction::EmitBlockLiteral(clang::CodeGen::CGBlockInfo
const&) + 91
6  clang             0x000000010a6b8403
clang::CodeGen::CodeGenFunction::EmitBlockLiteral(clang::BlockExpr const*) +
179
7  clang             0x000000010a095399 clang::StmtVisitorBase<clang::make_ptr,
(anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) +
11369
8  clang             0x000000010a092718
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 72
9  clang             0x000000010a2716ca
clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 74
10 clang             0x000000010a2715d0
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 432
11 clang             0x000000010a271022
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&) + 642
12 clang             0x000000010a270478
clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) + 72
13 clang             0x000000010a2703db
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 155
14 clang             0x000000010a0920fa
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 170
15 clang             0x000000010a091c90
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 32
16 clang             0x000000010a09233b
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot) + 251
17 clang             0x000000010a0920ea
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 154
18 clang             0x000000010a091c90
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 32
19 clang             0x000000010a08e133
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 819
20 clang             0x000000010a07d7d9
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 1801
21 clang             0x000000010a07ce57
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 215
22 clang             0x000000010a09d377
clang::CodeGen::CodeGenModule::EmitDeferred() + 183
23 clang             0x000000010a09d1b4
clang::CodeGen::CodeGenModule::Release() + 20
24 clang             0x000000010a09cf7d
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 93
25 clang             0x0000000109f68916 clang::ParseAST(clang::Sema&, bool) +
438
26 clang             0x0000000109f673d9 clang::CodeGenAction::ExecuteAction() +
857
27 clang             0x0000000109f3993f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 879
28 clang             0x0000000109f385cb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2683
29 clang             0x0000000109f2adce cc1_main(char const**, char const**,
char const*, void*) + 5086
30 clang             0x0000000109f055d8 main + 648
31 clang             0x0000000109f05344 start + 52

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