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: [email protected]
Reporter: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs