[LLVMbugs] [Bug 22316] New: invalid location range for variables in certain cases in debug info
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jan 23 13:45:41 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22316
Bug ID: 22316
Summary: invalid location range for variables in certain cases
in debug info
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: compnerd at compnerd.org
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
This seems to be reproducible across different architectures and OSes.
For x86:
/* RUN: clang -target i386-linux-gnu -g -O2 -c %s -o %t.obj */
void * __attribute__ (( regparm(2) )) f(void *, void *);
void * __attribute__ (( regparm(0) )) g(void *, void *);
void *g(void *t, void *k) {
if (k == (void *)0)
return (void *)0;
return f(t, k);
}
<...>
< 2><0x0000003c> DW_TAG_formal_parameter
DW_AT_location <loclist with 1 entries
follows>
[ 0]<lowpc=0x00000000><highpc=0x00000011>DW_OP_reg0
DW_AT_name "clang version 3.5.0
(based on LLVM 3.5.0svn)"
DW_AT_decl_file 0x00000001 /tmp/reduced.c
DW_AT_decl_line 0x00000005
DW_AT_type <0x0000005b>
<...>
00000000 <g>:
0: 8b 54 24 08 mov 0x8(%esp),%edx ; end of prologue
4: 85 d2 test %edx,%edx ; if (k == (void *)0)
6: 74 09 je 11 <g+0x11> ; return (void *)0;
8: 8b 44 24 04 mov 0x4(%esp),%eax ; setup $eax
c: e9 fc ff ff ff jmp d <g+0xd>
11: 31 c0 xor %eax,%eax
13: c3 ret
However, the DIE indicates that formal argument 0 is at DW_OP_reg0 or eax for
the entire subprogram. However, the disassembly clearly indicates that this
not the case for the if check. This results in invalid accesses for variables.
For ARM, you need to try a slightly different approach due to the AAPCS calling
convention. I believe the following worked:
void *f(void *, void *);
void *g(int, int, int, int, void *, void *);
void *g(int a, int b, int c, int d, void *t, void *k) {
if (k == (void *)0)
return (void *)0;
return f(t, k);
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150123/8404d6aa/attachment.html>
More information about the llvm-bugs
mailing list