]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Add testcase for already fixed test [PR121675]
authorJakub Jelinek <jakub@redhat.com>
Thu, 8 Jan 2026 08:47:38 +0000 (09:47 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 8 Jan 2026 08:47:38 +0000 (09:47 +0100)
This test was miscompiled due to stale REG_UNUSED vs. single_set,
fixed with r16-6062-ge1b8d097297.

2026-01-08  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/121675
* gcc.dg/pr121675.c: New test.

gcc/testsuite/gcc.dg/pr121675.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/pr121675.c b/gcc/testsuite/gcc.dg/pr121675.c
new file mode 100644 (file)
index 0000000..96b6bd9
--- /dev/null
@@ -0,0 +1,32 @@
+/* PR rtl-optimization/121675 */
+/* { dg-do run { target int32plus } } */
+/* { dg-options "-O3" } */
+
+int a, c, d, e;
+
+int
+foo (volatile int f, int g)
+{
+  f = -2;
+  if (!f)
+    a = 1;
+  c = 11 / f - g + 2;
+  g = c + 2;
+  if (!(1 / c + (g - 1)))
+    a = 1;
+  return a + f;
+}
+
+int
+main ()
+{
+  do
+    {
+      e = (foo (1, -1) - 30885397) % 2 - 3;
+      d = foo (1, -1) - 1430885400;
+    }
+  while (a + 1 == 0);
+  if (d + e != -1430885406)
+    __builtin_abort ();
+  return 0;
+}