[Bug target/124671] Argument with wrong alignment is passed to callee

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 30 07:49:56 GMT 2026


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2026-03-30
             Status|UNCONFIRMED                 |NEW
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=120839
     Ever confirmed|0                           |1
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'll note the circumstances the alignment is ignored are somewhat weird.  For

struct c {
  long double a;
  long double b;
} __attribute__((aligned(ALIGNMENT)));

__attribute__ ((noipa))
void foo (struct c *p)

the alignment isn't ignored (there's no unaligned TYPE_MAIN_VARIANT).

Likewise

typedef struct c2 {
  c x;
};

with original c has the alignment not ignored.  The ABI document says
types with larger declared alignment are properly aligned.

That said, testcases using standard C aka _Alignas and friends are
probably better than using GNU extensions here.

But confirmed, this is also something I noticed.  I'll note you can
also introuduce faults this way by doing aligned ZMM accesses in foo.

This is either the fault of the target (when it ignores the alignment
in ix86_function_arg_boundary), or failure of the middle-end to trigger
the required copy in the callee (as my fix was tried to fix).


More information about the Gcc-bugs mailing list