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

--- Comment #6 from Sergey Organov <sorganov at gmail dot com> ---
Contrary to the rationale for closing this bug, the option -freg-struct-return
seems to be supported and does work fine in some cases, see below. What do I
miss?

$ cat struct.c
typedef struct { int i; } T;

T f(int i)
{
  T r;
  r.i = i;
  return r;
}
$ ~/try/sparc-elf-5.2.0/bin/sparc-elf-gcc -O2 -freg-struct-return -save-temps
-c struct.c
$ cat struct.s
        .file   "struct.c"
        .section        ".text"
        .align 4
        .global f
        .type   f, #function
        .proc   010
f:
        jmp     %o7+8
         nop
        .size   f, .-f
        .ident  "GCC: (GNU) 5.2.0"
$ ~/try/sparc-elf-5.2.0/bin/sparc-elf-gcc -O2 -save-temps -c struct.c
$ cat struct.s
        .file   "struct.c"
        .section        ".text"
        .align 4
        .global f
        .type   f, #function
        .proc   010
f:
        ld      [%sp+64], %g1
        st      %o0, [%g1]
        jmp     %o7+12
         mov    %g1, %o0
        .size   f, .-f
        .ident  "GCC: (GNU) 5.2.0"
$

Reply via email to