Added 2 tests for PR118591.
Johann
--
AVR: Add test cases for PR118591.
gcc/testsuite/
PR rtl-optimization/118591
* gcc.target/avr/torture/pr118591-1.c: New test.
* gcc.target/avr/torture/pr118591-2.c: New test.
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr118591-1.c
b/gcc/testsuite/gcc.target/avr/torture/pr118591-1.c
new file mode 100644
index 00000000000..814f0410a7f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr118591-1.c
@@ -0,0 +1,22 @@
+/* { dg-do run { target { ! avr_tiny } } } */
+/* { dg-additional-options "-std=c99 -mlra" } */
+
+__attribute__((noipa))
+void func2 (long long a1, long long a2, long b)
+{
+ static unsigned char count = 0;
+ if (b != count++)
+ __builtin_abort ();
+}
+
+int main (void)
+{
+ for (long b = 0; b < 5; ++b)
+ {
+ __asm ("" ::: "r5", "r9", "r24", "r20", "r16", "r12", "r30");
+
+ func2 (0, 0, b);
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr118591-2.c
b/gcc/testsuite/gcc.target/avr/torture/pr118591-2.c
new file mode 100644
index 00000000000..83d36060088
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr118591-2.c
@@ -0,0 +1,21 @@
+/* Test case failed on avrtiny. */
+/* { dg-do run } */
+/* { dg-additional-options "-std=c99 -mlra" } */
+
+__attribute__((noipa))
+void func2 (long a, long b)
+{
+ static unsigned char count = 0;
+ if (b != count++)
+ __builtin_abort ();
+}
+
+int main (void)
+{
+ for (long b = 0; b < 5; ++b)
+ {
+ func2 (0, b);
+ }
+
+ return 0;
+}