https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90027

--- Comment #2 from vfdff <zhongyunde at huawei dot com> ---
for deja testcase: gcc.c-torture/execute/20010518-2.c 
as the struct a_struct define with __attribute__ ((packed)), so the member
variable b also not aligned with 4 bytes, is this case undefined behavior ?


typedef struct
{
  short a;
  long b;  /* Will not aligned with 4 bytes */
  short c;
  short d;
} __attribute__ ((packed)) a_struct;


int
main(void)
{
  volatile a_struct *a;
  volatile a_struct b;

  a = &b;
  *a = (a_struct){1,2,3,4};


  if (a->a != 1 || a->b != 2 || a->c != 3 || a->d != 4)
    abort ();

  exit (0);
}

Reply via email to