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

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
Yeah, I'd come up with essentially the same fix locally.  Was just trying
to see whether it is an ABI problem.  And I think it is.  For:

typedef unsigned long U __attribute__ ((aligned (16)));
typedef enum : U { V = 0 } W;

U
foo (int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7, U a, W b)
{
  return a + b;
}

GCC aligns the b stack argument to 16 bytes:

        ldr     x1, [sp]
        ldr     x0, [sp, 16]
        add     x0, x1, x0
        ret

whereas clang doesn't:

        ldp     x8, x9, [sp]
        add     x0, x9, x8
        ret

The clang behaviour is correct, so we'll need to fix it on the GCC side.

(Neither compiler aligns for register arguments.)

Reply via email to