https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109661
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Untested fix: 2023-04-28 Jakub Jelinek <ja...@redhat.com> PR target/109661 * config/aarch64/aarch64.cc (aarch64_function_arg_alignment): For ENUMERAL_TYPEs use alignment of TYPE_MAIN_VARIANT (TREE_TYPE (type)) rather than TYPE_MAIN_VARIANT (type). * g++.dg/other/pr109661.C: New test. --- gcc/config/aarch64/aarch64.cc.jj 2023-04-24 14:54:45.558075512 +0200 +++ gcc/config/aarch64/aarch64.cc 2023-04-28 10:37:58.013311653 +0200 @@ -7487,6 +7487,9 @@ aarch64_function_arg_alignment (machine_ if (!AGGREGATE_TYPE_P (type)) { + /* For enumeral types use the underlying type if possible. */ + if (TREE_CODE (type) == ENUMERAL_TYPE && TREE_TYPE (type)) + type = TREE_TYPE (type); /* The ABI alignment is the natural alignment of the type, without any attributes applied. Normally this is the alignment of the TYPE_MAIN_VARIANT, but not always; see PR108910 for a counterexample. --- gcc/testsuite/g++.dg/other/pr109661.C.jj 2023-04-28 10:41:21.169350306 +0200 +++ gcc/testsuite/g++.dg/other/pr109661.C 2023-04-28 10:40:46.246859362 +0200 @@ -0,0 +1,12 @@ +// PR target/109661 +// { dg-do compile { target c++11 } } +// { dg-options "-w" } */ + +typedef unsigned long U __attribute__ ((aligned (128))); +typedef enum : U { V = 0 } W; + +U +foo (U a, W b) +{ + return a + U (b); +} The question is if it is an ABI change from GCC 12 or not (GCC 13 ICEs on it, so ABI doesn't matter).