[LLVMbugs] [Bug 6060] New: Crash in 2D VLA arrays in function arguments

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Jan 16 11:39:48 PST 2010


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

           Summary: Crash in 2D VLA arrays in function arguments
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: cianci66 at mac.com
                CC: llvmbugs at cs.uiuc.edu


The following code causes clang to crash.

void foo(int i, int j, double array[i][j]) {
}

void bar() {
    int i = 3, j = 2;
    double array[i][j];

    foo(i, j, array);
}

Clang produces

$ clang -v -c test.c
clang version 1.1 (trunk 93629)
Target: x86_64-apple-darwin10
Thread model: posix
 "/Users/mark/Programs/llvm/Release/bin/clang" -cc1 -triple
x86_64-apple-darwin10.0 -S -disable-free -main-file-name test.c -pic-level 1
-mdisable-fp-elim -munwind-tables -target-cpu core2 -v -resource-dir
/Users/mark/Programs/llvm/Release/lib/clang/1.1 -fmessage-length 80
-stack-protector 1 -fblocks -fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/0W/0W0L1R9dEpmv7Y1akDNFUk+++TI/-Tmp-/cc-W4R0N3.s -x c test.c
clang -cc1 version 1.1 based upon llvm 2.7svn hosted on x86_64-apple-darwin10
#include "..." search starts here:
#include <...> search starts here:
 /Users/mark/Programs/llvm/Release/lib/clang/1.1/include
 /usr/local/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
Assertion failed: (V && "DeclRefExpr not entered in LocalDeclMap?"), function
EmitDeclRefLValue, file CGExpr.cpp, line 1048.
0  clang             0x00000001012c5622 PrintStackTrace(void*) + 34
1  clang             0x00000001012c5eac SignalHandler(int) + 652
2  libSystem.B.dylib 0x00007fff80d3deaa _sigtramp + 26
3  libSystem.B.dylib 000000000000000000 _sigtramp + 2133598576
4  libSystem.B.dylib 0x00007fff80db9e74 __pthread_markcancel + 0
5  clang             0x000000010019a15f
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) +
3551
6  clang             0x000000010019f245
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 469
7  clang             0x00000001001a2f56
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*) + 38
8  clang             0x00000001001bd904 (anonymous
namespace)::ScalarExprEmitter::EmitLoadOfLValue(clang::Expr const*) + 36
9  clang             0x00000001001c6d02 clang::StmtVisitor<(anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) + 5570
10 clang             0x00000001001c7269
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 121
11 clang             0x000000010022f3e5
clang::CodeGen::CodeGenFunction::EmitVLASize(clang::QualType) + 885
12 clang             0x000000010022f1a0
clang::CodeGen::CodeGenFunction::EmitVLASize(clang::QualType) + 304
13 clang             0x00000001001c70ff clang::StmtVisitor<(anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) + 6591
14 clang             0x00000001001c7269
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 121
15 clang             0x0000000100194882
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, llvm::Value*,
bool, bool, bool) + 82
16 clang             0x00000001001949c5
clang::CodeGen::CodeGenFunction::EmitAnyExprToTemp(clang::Expr const*, bool,
bool) + 85
17 clang             0x0000000100168db7
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::Expr const*,
clang::QualType) + 87
18 clang             0x00000001001a3c3b void
clang::CodeGen::CodeGenFunction::EmitCallArgs<clang::FunctionProtoType>(llvm::SmallVector<std::pair<clang::CodeGen::RValue,
clang::QualType>, 16u>&, clang::FunctionProtoType const*,
clang::ConstExprIterator, clang::ConstExprIterator) + 427
19 clang             0x0000000100194c26
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, llvm::Value*,
clang::CodeGen::ReturnValueSlot, clang::ConstExprIterator,
clang::ConstExprIterator, clang::Decl const*) + 470
20 clang             0x0000000100198c64
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) + 564
21 clang             0x00000001001c6c00 clang::StmtVisitor<(anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) + 5312
22 clang             0x00000001001c7269
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 121
23 clang             0x0000000100194882
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, llvm::Value*,
bool, bool, bool) + 82
24 clang             0x00000001002180c6
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 294
25 clang             0x000000010021abdb
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, llvm::Value*, bool) + 267
26 clang             0x000000010021af07
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 231
27 clang             0x0000000100217fd0
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 48
28 clang             0x00000001002322f5
clang::CodeGen::CodeGenFunction::GenerateCode(clang::CodeGen::GlobalDecl,
llvm::Function*) + 1989
29 clang             0x000000010023c4db
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::CodeGen::GlobalDecl)
+ 1067
30 clang             0x000000010023cc0b
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::CodeGen::GlobalDecl)
+ 587
31 clang             0x000000010023ceac
clang::CodeGen::CodeGenModule::EmitGlobal(clang::CodeGen::GlobalDecl) + 396
32 clang             0x000000010023d4e2
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 290
33 clang             0x000000010024d51c (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 60
34 clang             0x0000000100048a2e (anonymous
namespace)::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 158
35 clang             0x0000000100351835 clang::ParseAST(clang::Preprocessor&,
clang::ASTConsumer*, clang::ASTContext&, bool, bool,
clang::CodeCompleteConsumer*) + 277
36 clang             0x0000000100052009
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 393
37 clang             0x0000000100036bd0 cc1_main(char const**, char const**,
char const*, void*) + 2032
38 clang             0x0000000100039464 main + 2052
39 clang             0x0000000100034918 start + 52
Stack dump:
0.      Program arguments: /Users/mark/Programs/llvm/Release/bin/clang -cc1
-triple x86_64-apple-darwin10.0 -S -disable-free -main-file-name test.c
-pic-level 1 -mdisable-fp-elim -munwind-tables -target-cpu core2 -v
-resource-dir /Users/mark/Programs/llvm/Release/lib/clang/1.1 -fmessage-length
80 -stack-protector 1 -fblocks -fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/0W/0W0L1R9dEpmv7Y1akDNFUk+++TI/-Tmp-/cc-W4R0N3.s -x c test.c 
1.      <eof> parser at end of file
2.      test.c:4:6: LLVM IR generation of declaration 'bar'
3.      test.c:4:6: Generating code for declaration 'bar'
4.      test.c:4:12: LLVM IR generation of compound statement ('{}')
clang: error: compiler command failed due to signal 6 (use -v to see
invocation)


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