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

            Bug ID: 68378
           Summary: Return value optimization does not fire iff in C mode
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eyal.lotem at gmail dot com
  Target Milestone: ---

struct Foo { int x[1000]; };
struct Foo f(void);
struct Foo g(void) {
    struct Foo x = f();
    return x;
}

When built with -O3 -xc this generates superfluous inefficient copying.
When built with -O3 -xc++ this generates an efficient call without copying.

Copying should not be generated here.

Reply via email to