This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
will __attribute__((aligned(CACHE_LINE_SIZE))) break struct alignment
- From: Yubin Ruan <ablacktshirt at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 6 Nov 2017 13:04:28 +0800
- Subject: will __attribute__((aligned(CACHE_LINE_SIZE))) break struct alignment
- Authentication-results: sourceware.org; auth=none
Hi,
I am using something like this:
struct S1 {
int index __attribute__((aligned(CACHE_LINE_SIZE)));
struct S2 some_other;
};
I am not using anything like `#pragma pack`.
I am wondering whether adding that
`__attribute__((aligned(CACHE_LINE_SIZE)))` will break GCC's automatic
alignment for S1 and S2. Can anyone point me to any document which
specify this behavior?
Thanks,
Yubin