[LLVMbugs] [Bug 22432] New: Invalid location was generated for variable when passing its address to other function
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Feb 2 06:59:06 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22432
Bug ID: 22432
Summary: Invalid location was generated for variable when
passing its address to other function
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: amjad.aboud at intel.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 13791
--> http://llvm.org/bugs/attachment.cgi?id=13791&action=edit
LIT test that fails due to the described bug
A LIT test that fails due to this bug is attached.
Source:
--------
int foo(int *x);
int main()
{
int c = 5;
foo(&c);
return c;
}
Assembly (x86_64-pc-linux):
----------------------------
test.o: file format ELF64-x86-64
Disassembly of section .text:
main:
0: pushq %rax
1: movl $5, 4(%rsp)
9: leaq 4(%rsp), %rdi
e: callq 0
13: movl 4(%rsp), %eax
17: popq %rdx
18: retq
Debug Info of "c" variable:
---------------------------
0x0000003f: DW_TAG_variable [3]
DW_AT_location [DW_FORM_sec_offset] (0x00000000)
DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000047] = "c")
DW_AT_decl_file [DW_FORM_data1] ("test.c")
DW_AT_decl_line [DW_FORM_data1] (5)
DW_AT_type [DW_FORM_ref4] (cu + 0x004f => {0x0000004f})
.debug_loc contents:
0x00000000: Beginning address offset: 0x0000000000000001
Ending address offset: 0x000000000000000e
Location description: 11 05 9f
Beginning address offset: 0x000000000000000e
Ending address offset: 0x0000000000000019
Location description: 75 00
Location: 75 00 ==> (DW_OP_breg5 (rdi): 0)
However, %rdi is a scratch register according to Linux-64 calling convention
and thus could change its value once return from the called function.
Notice that this bug is different from 22316, as in this case the called
function receives the address of the variable and not the variable itself.
--
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/20150202/401cf050/attachment.html>
More information about the llvm-bugs
mailing list