[LLVMbugs] [Bug 16248] New: movaps used for unaligned memory involving va_list and nested structs
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jun 6 14:01:37 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16248
Bug ID: 16248
Summary: movaps used for unaligned memory involving va_list and
nested structs
Product: clang
Version: 3.2
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: llvm-bugs at justinbogner.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130606/70b830f2/attachment.html>
More information about the llvm-bugs
mailing list