https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671
--- Comment #39 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
one thing I do not understand is this:
if I do this in Jakub's test case:
new (b.u.b) A (x);
//c = *p;
__builtin_memcpy(&c, p, sizeof(B));
bar (*p, c);
the mis-compilation goes away,
if I add this to Jakub's test case:
struct B
{
int x;
union U
{
int a;
char b[sizeof (float)];
} u;
int y;
B() {}
B(int xx, U uu, int yy):x(xx), u(uu), y(yy) {}
B(B &o)
{
__asm("":::"memory");
__builtin_memcpy(this, &o, sizeof(B));
__asm("":::"memory");
}
};
The mis-compilation gets not fixed.
Why?