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

--- Comment #84 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
I think the patch should also handle
arrays of unions like:

union BB {
  unsigned char x[10];
};
struct B {
  BB x[16];
};
struct A {
  B b;
};

A a1, a2;
void test()
{
  a1.b = a2.b;
}

compiles to:
; Function void test() (_Z4testv, funcdef_no=0, decl_uid=2384, cgraph_uid=0,
symbol_order=2)

void test() ()
{
  <bb 2> [0.00%]:
  a1.b = a2.b;
  return;

}


while in this example
struct B {
  unsigned char x[16];
};
struct A {
  B b;
};

A a1, a2;
void test()
{
  a1.b = a2.b;
}

compiles to:
;; Function void test() (_Z4testv, funcdef_no=0, decl_uid=2348, cgraph_uid=0,
symbol_order=2)

void test() ()
{
  <bb 2> [0.00%]:
  MEM[(void *)&a1] = MEM[(void *)&a2];
  return;

}

which is probably unnecessary, because all valid examples
used a union with an array of unsigned char.  Right?

Reply via email to