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

            Bug ID: 86094
           Summary: [8/9 Regression] Call ABI changed for small objects
                    with defaulted ctor
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: ABI, wrong-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
  Target Milestone: ---

When compiling the following with -O2 -std=c++11:

struct S {
    S(S&&) = default;
    int i;
};

S foo(S s)
{
    return s;
}

gcc-7 and earlier emit

_Z3foo1S:
        movl    %edi, %eax
        ret

but gcc-8 and trunk emit

_Z3foo1S:
        movl    (%rsi), %edx
        movq    %rdi, %rax
        movl    %edx, (%rdi)
        ret

i.e. the object is now passed in memory rather than on register. This appears
to be a silent ABI change.

(Clang generates the same code as gcc-7)

Reply via email to