will __attribute__((aligned(CACHE_LINE_SIZE))) break struct alignment

Yubin Ruan ablacktshirt@gmail.com
Mon Nov 6 05:04:00 GMT 2017


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?


More information about the Gcc-help mailing list