https://gcc.gnu.org/g:68da681e614c2750f648dac2cd0b2595999ca5d9

commit r15-2888-g68da681e614c2750f648dac2cd0b2595999ca5d9
Author: Georg-Johann Lay <a...@gjlay.de>
Date:   Mon Aug 12 14:39:24 2024 +0200

    AVR: target/85624 - Fix non-matching alignment in clrmem* insns.
    
    The clrmem* patterns don't use the provided alignment information,
    hence the setmemhi expander can just pass down 0 as alignment to
    the clrmem* insns.
    
            PR target/85624
    gcc/
            * config/avr/avr.md (setmemhi): Set alignment to 0.
    
    gcc/testsuite/
            * gcc.target/avr/torture/pr85624.c: New test.

Diff:
---
 gcc/config/avr/avr.md                          | 2 ++
 gcc/testsuite/gcc.target/avr/torture/pr85624.c | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 84dfe4c40ecf..359343e563d5 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -1355,6 +1355,8 @@
                                     gen_int_mode (INTVAL (operands[1]), mode));
     rtx addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
     operands[0] = gen_rtx_MEM (BLKmode, addr0);
+    // Alignment is unused; just set it to 0.
+    operands[3] = const0_rtx;
   })
 
 
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr85624.c 
b/gcc/testsuite/gcc.target/avr/torture/pr85624.c
new file mode 100644
index 000000000000..b183d4558df7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr85624.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+
+int foo (void)
+{
+  volatile int arr[3] __attribute__((aligned(128))) = { 0 };
+  return arr[2];
+}

Reply via email to