<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:llvm-bugs@justinbogner.com" title="Justin Bogner <llvm-bugs@justinbogner.com>"> <span class="fn">Justin Bogner</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - movaps used for unaligned memory involving va_list and nested structs"
href="http://llvm.org/bugs/show_bug.cgi?id=16248">bug 16248</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>FIXED
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - movaps used for unaligned memory involving va_list and nested structs"
href="http://llvm.org/bugs/show_bug.cgi?id=16248#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - movaps used for unaligned memory involving va_list and nested structs"
href="http://llvm.org/bugs/show_bug.cgi?id=16248">bug 16248</a>
from <span class="vcard"><a class="email" href="mailto:llvm-bugs@justinbogner.com" title="Justin Bogner <llvm-bugs@justinbogner.com>"> <span class="fn">Justin Bogner</span></a>
</span></b>
<pre>While this doesn't segfault anymore, it doesn't seem to do the right thing. The
value that comes out of va_arg is garbage from somewhere nearby on the stack.
Here's the program from before with a main added to demonstrate:
#include <stdarg.h>
#include <stdio.h>
#include <inttypes.h>
typedef struct Uuid128 {
__uint128_t __uint;
} Uuid128_t;
typedef struct SiteUuid {
Uuid128_t su_uuid;
} SiteUuid_t;
void
vloadSiteUuid(void *entryRef, va_list argList)
{
SiteUuid_t *su = entryRef;
su->su_uuid = va_arg(argList, Uuid128_t);
}
void
loadSiteUuid(void *entryRef, ...)
{
va_list args;
va_start(args, entryRef);
vloadSiteUuid(entryRef, args);
va_end(args);
}
int
main(int argc, const char *argv[])
{
SiteUuid_t Buf;
Uuid128_t uuid = {
(__uint128_t)0x0f0e0d0c0b0a0908 << 64 | 0x0706050403020100
};
printf("%016" PRIx64 "%016" PRIx64 "\n",
(uint64_t)(uuid.__uint >> 64),
(uint64_t)uuid.__uint);
// prints 0f0e0d0c0b0a09080706050403020100
loadSiteUuid(&Buf, uuid);
printf("%016" PRIx64 "%016" PRIx64 "\n",
(uint64_t)(Buf.su_uuid.__uint >> 64),
(uint64_t)Buf.su_uuid.__uint);
// does not print 0f0e0d0c0b0a09080706050403020100
}
When I disassembled the relevant function in my bigger program, I could see the
correct value in two places on the stack, one of which was aligned, but the
value returned was 0x60 away from there.</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>