<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - [DebugInfo] X86DiscriminateMemOps inserts potentially misleading line numbers"
href="https://bugs.llvm.org/show_bug.cgi?id=40319">40319</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[DebugInfo] X86DiscriminateMemOps inserts potentially misleading line numbers
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jeremy.morse.llvm@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, davidxl@google.com, douglas_yung@playstation.sony.com, greg.bedwell@sony.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, mtrofin@google.com, spatel+llvm@rotateright.com, wmi@google.com
</td>
</tr></table>
<p>
<div>
<pre>Hi, if one compiles the following sample with llvm/clang r351192 and the
command line "clang -x c++ test.cpp -fdebug-info-for-profiling
-fstack-protector -o a.out -O0 -g -c",
--------8<--------
int foo (int input_param)
{
int array1[input_param];
array1[0]=18;
return array1[0];
}
-------->8--------
And then examine the line tables with dwarfdump -l a.out:
--------8<--------
0x00000000 [ 2, 0] NS uri: "/home/jmorse/fdebug.cpp"
0x00000011 [ 1, 0] NS PE DI=0x2
0x00000015 [ 1, 0] DI=0x4
0x00000018 [ 3,16] NS
0x0000001d [ 3, 5]
0x00000020 [ 3, 5] DI=0x2
0x00000024 [ 3, 5] DI=0x4
...
-------->8--------
We have the line numbers going backwards at the start of the function (two to
one to three). This is due to the x86-discriminate-memops pass picking the
default line number to instrument memory operations with as being the start of
the function. (See ReferenceDI in X86DiscriminateMemOps.cpp).
These line numbers are potentially misleading IMHO -- would we be able to use a
zero line number by default instead? According to the DWARF spec this
corresponds to compiler-generated code and will be ignored by debuggers. That
way X86DiscriminateMemOps won't have any affect on debugging, and the change
(AFAIK) will have no effect on its operation.</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>