http://llvm.org/bugs/show_bug.cgi?id=2489
Summary: clang -g segfaults on functions with arguments
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: LLVM Codegen
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
CC: [email protected]
It seems that clang debug output (clang -g) breaks on any function that has
arguments.
The problem is easily illustrated using the following trivial foo.c:
void foo(int blaa) { }
[EMAIL PROTECTED]:~/src/montiumccfe$ gdb --args clang -g -emit-llvm foo.c
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211607360 (LWP 19210)]
0x083c4765 in clang::CodeGen::CGDebugInfo::EmitDeclare (this=0x8773d00,
decl=0x8768330, Tag=257, AI=0x877891c, [EMAIL PROTECTED]) at
CGDebugInfo.cpp:730
730 Variable->setContext(RegionStack.back());
(gdb) bt
#0 0x083c4765 in clang::CodeGen::CGDebugInfo::EmitDeclare (this=0x8773d00,
decl=0x8768330, Tag=257, AI=0x877891c, [EMAIL PROTECTED]) at
CGDebugInfo.cpp:730
#1 0x083de65a in clang::CodeGen::CodeGenFunction::EmitParmDecl
(this=0xbfb25ab0, [EMAIL PROTECTED], Arg=0x87788a8) at CGDecl.cpp:229
#2 0x083dd07a in clang::CodeGen::CodeGenFunction::GenerateCode
(this=0xbfb25ab0, FD=0x8770e88) at CodeGenFunction.cpp:123
#3 0x083b1f07 in clang::CodeGen::CodeGenModule::EmitFunction (this=0x8771938,
FD=0x8770e88) at CodeGenModule.cpp:525
#4 0x083add62 in (anonymous namespace)::CodeGenerator::HandleTopLevelDecl
(this=0x8768b18, D=0x8770e88) at ModuleBuilder.cpp:69
#5 0x0846dc81 in clang::ParseAST ([EMAIL PROTECTED], Consumer=0x8768b18,
PrintStats=false) at ParseAST.cpp:63
#6 0x083a1572 in ProcessInputFile ([EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]) at clang.cpp:1305
#7 0x083a1f7b in main (argc=Cannot access memory at address 0xfffffffc
) at clang.cpp:1527
(gdb) p RegionStack.size()
$1 = 0
It seems that the declarations for the parameters are emitted before the
function start is emitted, since RegionStack is still empty (which causes the
problem). This can probably be fixed by emitting debug info for the parameter
declarations just after emitting the function start, instead of in
EmitParmDecl.
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs