On 12/12/2012 02:57 AM, Richard Biener wrote:
> That looks wrong.  Having both TYPE_PACKED and TYPE_ALIGN != BITS_PER_UNIT
> is inconsistent, so this part of the patch should not be necessary.

No, that is the only way to give a 4 byte int 2 byte alignment:
use both packed and aligned attributes.

struct S {
  char x;
  int y;
};

struct T {
  char x;
  int y __attribute__((aligned(2)));
};

struct U {
  char x;
  int y __attribute__((packed, aligned(2)));
};

int s_y = __builtin_offsetof(struct S, y);
int t_y = __builtin_offsetof(struct T, y);
int u_y = __builtin_offsetof(struct U, y);


r~

Reply via email to