<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Invalid location was generated for variable when passing its address to other function"
href="http://llvm.org/bugs/show_bug.cgi?id=22432">22432</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Invalid location was generated for variable when passing its address to other function
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>amjad.aboud@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=13791" name="attach_13791" title="LIT test that fails due to the described bug">attachment 13791</a> <a href="attachment.cgi?id=13791&action=edit" title="LIT test that fails due to the described bug">[details]</a></span>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>