<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 --- - movaps used for unaligned memory involving va_list and nested structs"
href="http://llvm.org/bugs/show_bug.cgi?id=16248">16248</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>movaps used for unaligned memory involving va_list and nested structs
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>llvm-bugs@justinbogner.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>The following produces movaps instrcutions for the access of Uuid128_t
from the va_list on x86_64:
/* movaps.c - compile as "clang -O2 movaps.c -S -o movaps.s" */
#include <stdarg.h>
typedef struct Uuid128 {
__uint128_t __uint;
} Uuid128_t;
typedef struct SiteUuid {
Uuid128_t su_uuid;
} SiteUuid_t;
void
loadSiteUuid(void *entryRef, va_list argList)
{
SiteUuid_t *su = entryRef;
su->su_uuid = va_arg(argList, Uuid128_t);
}
When called, this tends to crash, as the __uint128_t doesn't seem to
end up at a 16 byte aligned address.
On the other hand, this very similar program generates four mov
instructions instead, thus working correctly:
/* 4mov.c - compile as "clang -O2 4mov.c -S -o 4mov.s" */
#include <stdarg.h>
typedef struct Uuid128 {
__uint128_t __uint;
} Uuid128_t;
void
loadSiteUuid(void *entryRef, va_list argList)
{
Uuid128_t *su = entryRef;
su->su_uuid = va_arg(argList, __uint128_t);
}
This makes me think that clang recognizes the alignment requirements
of __uint128_t and avoid the vector op, but that nesting it in a
struct confuses things.</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>