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

            Bug ID: 117098
           Summary: Tail call doesn't work for x32
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: x86-64

[hjl@gnu-tgl-3 tmp]$ cat x.c
struct A { int a[6]; void *p[7]; };

int baz (int a, int b, int c, void *p, struct A s);

int
foo (int a, int b, int c, void *p, struct A s)
{
  return baz (a, b, c, p, s);
}
[hjl@gnu-tgl-3 tmp]$ gcc -S -O2 -mx32 /tmp/x.c
[hjl@gnu-tgl-3 tmp]$ cat x.s
        .file   "x.c"
        .text
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        subl    $72, %esp
        .cfi_def_cfa_offset 80
        movdqu  80(%rsp), %xmm0
        movl    128(%rsp), %eax
        movups  %xmm0, (%rsp)
        movdqu  96(%rsp), %xmm0
        movl    %eax, 48(%rsp)
        movups  %xmm0, 16(%rsp)
        movdqu  112(%rsp), %xmm0
        movups  %xmm0, 32(%rsp)
        call    baz
        addl    $72, %esp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 14.2.1 20240912 (Red Hat 14.2.1-3)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-tgl-3 tmp]$ gcc -S -O2 -m64 /tmp/x.c
[hjl@gnu-tgl-3 tmp]$ cat x.s
        .file   "x.c"
        .text
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        jmp     baz
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 14.2.1 20240912 (Red Hat 14.2.1-3)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-tgl-3 tmp]$

Reply via email to