<html>
<head>
<base href="https://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 --- - Wrong debugging information with -fsanitize=address (and memset?)"
href="https://llvm.org/bugs/show_bug.cgi?id=26673">26673</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong debugging information with -fsanitize=address (and memset?)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>peter@lekensteyn.nl
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=15921" name="attach_15921" title="Minimal test case (with commands and output in comments)">attachment 15921</a> <a href="attachment.cgi?id=15921&action=edit" title="Minimal test case (with commands and output in comments)">[details]</a></span>
Minimal test case (with commands and output in comments)
Since a while (months), Clang with ASAN on Arch Linux generates objects which
have wrong debugging information. The addresses seems incorrect and will result
in wrong debugging output.
I have reduced it to a function containing a memset (printf does not trigger
the issue for example). See the following output (argc is expected to be 1,
argv an address like 0x7fffffffe418).
$ clang -fsanitize=address -g test.c && gdb -ex start -batch ./a.out
Temporary breakpoint 1 at 0x4d8ce7: file test.c, line 15.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Temporary breakpoint 1, main (argc=4289312, argv=0x4d8e6d <__libc_csu_init+77>)
at test.c:35
35 int main(int argc, char *argv[]) {
$ lldb ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) breakpoint set -name main
Breakpoint 1: where = a.out`main + 23 at test.c:35, address =
0x00000000004d8ce7
(lldb) r
AddressSanitizer debugger support is active. Memory error breakpoint has been
installed and you can now use the 'memory history' command.
Process 4799 launched: './a.out' (x86_64)
Process 4799 stopped
* thread #1: tid = 4919, 0x00000000004d8ce7 a.out`main(argc=4289312,
argv=0x00000000004d8e6d) + 23 at test.c:35, name = 'a.out', stop reason =
breakpoint 1.1
frame #0: 0x00000000004d8ce7 a.out`main(argc=4289312,
argv=0x00000000004d8e6d) + 23 at test.c:35
32 */
33 extern void *memset(void *, int, unsigned long);
34
-> 35 int main(int argc, char *argv[]) {
36 int action;
37 memset(&action, 0, sizeof(action));
38 return 0;
$ pacman -Q clang lldb gdb
clang 3.7.1-1
lldb 3.7.1-1
gdb 7.10.1-1
$ clang --version
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix</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>