[LLVMbugs] [Bug 14825] New: crash in codegen with local template argument
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Jan 6 22:34:24 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=14825
Bug #: 14825
Summary: crash in codegen with local template argument
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: nlewycky at google.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
struct Outer {
template <typename T> struct Inner {
static int member;
};
template <typename T> void Get() {
int m = Inner<T>::member;
}
};
void test() {
struct local {};
Outer o;
typedef void (Outer::*mptr)();
mptr method = &Outer::Get<local>;
}
There's a similar report at bug 9685 but I think this is different (I think the
proximate cause in this bug is that 'member' doesn't have a linkage).
Here's the crash:
nlewycky at ducttape:~$ llvm/Debug+Asserts/bin/clang -std=gnu++11 y.cc
y.cc:3:16: warning: variable 'Outer::Inner<local>::member' has internal linkage
but is not defined
static int member;
^
y.cc:6:23: note: used here
int m = Inner<T>::member;
^
clang: CGExpr.cpp:1682: clang::CodeGen::LValue
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(const clang::DeclRefExpr*):
Assertion `isa<BlockDecl>(CurCodeDecl) && E->refersToEnclosingLocal()' failed.
0 clang 0x0000000002da72da
1 clang 0x0000000002da6fb0
2 libpthread.so.0 0x00007f8e9add7cb0
3 libc.so.6 0x00007f8e9a029425 gsignal + 53
4 libc.so.6 0x00007f8e9a02cb8b abort + 379
5 libc.so.6 0x00007f8e9a0220ee
6 libc.so.6 0x00007f8e9a022192
7 clang 0x0000000000febb14
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) +
1350
8 clang 0x0000000000fe6d7a
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 482
9 clang 0x0000000000fe6aed
clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*,
clang::CodeGen::CodeGenFunction::TypeCheckKind) + 51
10 clang 0x0000000001029729
11 clang 0x00000000010297f4
12 clang 0x0000000001029fe5
13 clang 0x00000000010392b1
14 clang 0x0000000001029a03
15 clang 0x000000000102f583
16 clang 0x0000000001039e6b
17 clang 0x0000000001039251
18 clang 0x0000000001029a03
19 clang 0x0000000001037fd2
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 156
20 clang 0x0000000000fce4bf
clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 93
21 clang 0x0000000000fd091a
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 396
22 clang 0x0000000000fd03c0
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&) + 718
23 clang 0x0000000000fcf2fa
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&) + 58
24 clang 0x0000000000fcca0b
clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) + 91
25 clang 0x0000000000fcc95d
clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) + 181
26 clang 0x000000000109bc4d
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 107
27 clang 0x0000000001099493
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 291
28 clang 0x0000000001098f63
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 75
29 clang 0x000000000109967b
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot) + 241
30 clang 0x0000000001099452
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 226
31 clang 0x0000000001098f63
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 75
32 clang 0x00000000010b2722
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&)
+ 154
33 clang 0x00000000010b2c61
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1035
34 clang 0x0000000000f23b7b
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 939
35 clang 0x0000000000f2065b
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 365
36 clang 0x0000000000f1ef6a
clang::CodeGen::CodeGenModule::EmitDeferred() + 340
37 clang 0x0000000000f1ce7a clang::CodeGen::CodeGenModule::Release()
+ 24
38 clang 0x0000000000f18d35
39 clang 0x0000000000f17625
40 clang 0x00000000010dabe2 clang::ParseAST(clang::Sema&, bool, bool)
+ 774
41 clang 0x0000000000cfba02 clang::ASTFrontendAction::ExecuteAction()
+ 298
42 clang 0x0000000000f16962 clang::CodeGenAction::ExecuteAction() +
1240
43 clang 0x0000000000cfb61d clang::FrontendAction::Execute() + 197
44 clang 0x0000000000cd2401
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 719
45 clang 0x0000000000ca2d70
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1018
46 clang 0x0000000000c931c0 cc1_main(char const**, char const**, char
const*, void*) + 759
47 clang 0x0000000000c9d76f main + 496
48 libc.so.6 0x00007f8e9a01476d __libc_start_main + 237
49 clang 0x0000000000c92909
Stack dump:
0. Program arguments:
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
y.cc -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22 -momit-leaf-frame-pointer -resource-dir
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/../lib/clang/3.3
-fmodule-cache-path /var/tmp/clang-module-cache -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/local/include -internal-isystem
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/../lib/clang/3.3/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=gnu++11 -fdeprecated-macro -fdebug-compilation-dir
/usr/local/google/home/nlewycky -ferror-limit 19 -fmessage-length 190
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops
-o /tmp/y-0WxHE2.o -x c++ y.cc
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. y.cc:5:30: Generating code for declaration 'Outer::Get'
4. y.cc:5:36: LLVM IR generation of compound statement ('{}')
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.3 (trunk 171701:171702M) (llvm/trunk 171701)
Target: x86_64-unknown-linux-gnu
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:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/y-UJSwuw.cpp
clang: note: diagnostic msg: /tmp/y-UJSwuw.sh
clang: note: diagnostic msg:
********************
--
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