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: unassignedclangb...@nondot.org
Reporter: westion...@gmail.com
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs