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

            Bug ID: 87370
           Summary: Regression in return struct code
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trashyankes at wp dot pl
  Target Milestone: ---

Test case: https://gcc.godbolt.org/z/58JsxE

```
struct A
{
    int b[4];
};
struct B
{
    char a[12];
    int b;
};
struct C
{
    char a[16];
};

A f1(int i)
{
    return { };
}

B f2(int i)
{
    return { };
}

C f3(int i)
{
    return { };
}
```

On x86_64 it create assembly:
```
f1(int):
  xor eax, eax
  xor edx, edx
  ret
f2(int):
  pxor xmm0, xmm0
  xor eax, eax
  movaps XMMWORD PTR [rsp-24], xmm0
  mov rdx, QWORD PTR [rsp-16]
  ret
f3(int):
  xor eax, eax
  xor edx, edx
  ret
```

Clang and GCC 6.3 generate same code for every function functions.

Reply via email to