public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/114136] New: wrong code for c23 fully anonymous arg lists on arm
@ 2024-02-27 17:19 rearnsha at gcc dot gnu.org
  2024-02-27 17:23 ` [Bug middle-end/114136] " rearnsha at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2024-02-27 17:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114136
           Summary: wrong code for c23 fully anonymous arg lists on arm
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rearnsha at gcc dot gnu.org
  Target Milestone: ---
            Target: arm

On arm, a fully anonymous c23-style function is called incorrectly.  All
arguments are passed on the stack while the receiving function expects r0-r3 to
be used for the initial arguments.

For example,

void f (...);

void g()
{
    f (1, 2, 3, 4);
}

With gcc compiles to:

g:
        push    {lr}
        movs    r0, #1
        movs    r1, #2
        sub     sp, sp, #20
        movs    r2, #3
        movs    r3, #4
        stm     sp, {r0, r1, r2, r3}  // Arguments pushed to stack (wrong)
        bl      f
        add     sp, sp, #20
        ldr     pc, [sp], #4

When the correct code (eg, as produced by clang) is something like

g:
        mov     r0, #1
        mov     r1, #2
        mov     r2, #3
        mov     r3, #4
        b       f

compile with, eg 

arm-non-eabi-gcc -O2 -c23

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-04 11:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 17:19 [Bug middle-end/114136] New: wrong code for c23 fully anonymous arg lists on arm rearnsha at gcc dot gnu.org
2024-02-27 17:23 ` [Bug middle-end/114136] " rearnsha at gcc dot gnu.org
2024-02-27 17:29 ` pinskia at gcc dot gnu.org
2024-03-01 14:48 ` cvs-commit at gcc dot gnu.org
2024-03-02  0:39 ` cvs-commit at gcc dot gnu.org
2024-03-04 11:35 ` rearnsha at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).