[llvm-bugs] [Bug 35273] New: aligned attribute can not work well when compile with option -fpack-struct
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 10 00:15:29 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35273
Bug ID: 35273
Summary: aligned attribute can not work well when compile with
option -fpack-struct
Product: clang
Version: trunk
Hardware: Other
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: westion717 at gmail.com
CC: llvm-bugs at lists.llvm.org
#include <stdio.h>
#include <stddef.h>
struct A {
float a;
vector short b __attribute__((packed));
vector signed short c __attribute__((packed));
vector unsigned char d __attribute__((aligned(16)));
double e;
};
int main(){
struct A a;
printf("offset of a.d = %d\n",offsetof(struct A,d));
printf("alignment of a.d = %d\n",__alignof__(a.d));
}
/gsa/tlbgsa/projects/x/xlcmpbld/run/clang/main_trunk/linux_leppc/daily/latest/bin/clang
a.c -fpack-struct
./a.out
unexpected output:
offset of a.d = 36
alignment of a.d = 1
gcc a.c -fpack-struct
./a.out
expected output:
offset of a.d = 48
alignment of a.d = 16
--
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/20171110/01cbda4d/attachment-0001.html>
More information about the llvm-bugs
mailing list