<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 --- - Memory corruption bug in clang 3.2"
href="http://llvm.org/bugs/show_bug.cgi?id=15698">15698</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Memory corruption bug in clang 3.2
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</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>tiffany@stormbit.net
</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=10317" name="attach_10317" title="File from crash report">attachment 10317</a> <a href="attachment.cgi?id=10317&action=edit" title="File from crash report">[details]</a></span>
File from crash report
Steps to reproduce:
1: Download <a href="https://raw.github.com/troydhanson/uthash/master/src/uthash.h">https://raw.github.com/troydhanson/uthash/master/src/uthash.h</a>
2: Try to compile the following:
#include "uthash.h"
struct module {
UT_hash_handle hh;
} *modules = NULL;
int main()
{
struct module *mod1, *mod2;
HASH_REPLACE_STR(modules, hh, mod1, mod2);
}
Output:
$ clang test.c
test.c:10:35: error: passing 'UT_hash_handle' (aka 'struct UT_hash_handle') to
parameter of incompatible type 'const char *'
*** Error in `/usr/bin/clang': malloc(): memory corruption (fast):
0x0000000002831f40 ***
It produces no crash report in this shorter version. Here is the crash report
from when I discovered it: <a href="http://paste.strictfp.com/37342">http://paste.strictfp.com/37342</a>
log-aUMbnp.c is attached
log-aUMbnp.sh: /usr/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -main-file-name log.c
-mrelocation-model pic -pic-level 2 -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -target-linker-version 2.23.1 -momit-leaf-frame-pointer -g
-D "DEBUG" -D "_POSIX_C_SOURCE=200809" -Wall -pedantic -std=c99 -ferror-limit
19 -fmessage-length 134 -pthread -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -x c log-aUMbnp.c
$ clang -v
clang version 3.2 (tags/RELEASE_32/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ uname -a
Linux arch 3.8.4-1-ARCH #1 SMP PREEMPT Wed Mar 20 22:10:25 CET 2013 x86_64
GNU/Linux</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>