The PR54412 series converts assign_parm_setup_stack to
assign_stack_local_aligned, which also fixes PR97473: an over-aligned
scalar parameter whose address is taken was spilled by
assign_parm_setup_stack through assign_stack_local, so its slot got
whatever alignment the frame could promise.  Add the execution test.

Aborts on arm-none-eabi (armv6, qemu) at current trunk and passes with
the series applied.

Assisted-by: Claude Opus 5 (Anthropic)

        PR middle-end/97473

gcc/testsuite/ChangeLog:

        PR middle-end/97473
        * gcc.dg/pr97473.c: New test.

Signed-off-by: Dominic P <[email protected]>
---
Your series also fixes PR97473, so I am dropping my narrower patch for
that one call site.  This is the execution test from it; it aborts at
current trunk and passes with your v2 applied (arm-none-eabi, qemu).

 gcc/testsuite/gcc.dg/pr97473.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr97473.c

diff --git a/gcc/testsuite/gcc.dg/pr97473.c b/gcc/testsuite/gcc.dg/pr97473.c
new file mode 100644
index 00000000000..bc7fd2e7330
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97473.c
@@ -0,0 +1,33 @@
+/* An over-aligned scalar parameter whose address is taken.  */
+
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#define ALIGNMENT 64
+
+typedef int V __attribute__((aligned (ALIGNMENT)));
+
+void check (V *) __attribute__((noipa));
+void two (V, V) __attribute__((noipa));
+
+void
+check (V *p)
+{
+  if ((__UINTPTR_TYPE__) p % ALIGNMENT != 0)
+    __builtin_abort ();
+}
+
+/* Two parameters, in case one is sufficiently aligned by chance.  */
+void
+two (V x, V y)
+{
+  check (&x);
+  check (&y);
+}
+
+int
+main (void)
+{
+  two (-43, 29);
+  return 0;
+}
-- 
2.55.0

Reply via email to