]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Add testcase for already fixed PR [PR120322]
authorJakub Jelinek <jakub@redhat.com>
Thu, 15 Jan 2026 06:46:24 +0000 (07:46 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 15 Jan 2026 06:46:24 +0000 (07:46 +0100)
This testcase started to be miscompiled with r16-170 and got fixed
again with r16-960.

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

PR tree-optimization/120322
* gcc.dg/torture/pr120322.c: New test.

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

diff --git a/gcc/testsuite/gcc.dg/torture/pr120322.c b/gcc/testsuite/gcc.dg/torture/pr120322.c
new file mode 100644 (file)
index 0000000..8697c28
--- /dev/null
@@ -0,0 +1,33 @@
+/* PR tree-optimization/120322 */
+/* { dg-do run } */
+/* { dg-additional-options "-fno-early-inlining" } */
+
+int a, b, c;
+
+void
+foo (int e)
+{
+  if (e > 0)
+    while (b)
+      ;
+}
+
+void
+bar (unsigned short e)
+{
+  foo (e);
+}
+
+static void
+baz (short e)
+{
+  bar (e);
+  c = a;
+}
+
+int
+main ()
+{
+  if (sizeof (int) > sizeof (short))
+    baz (-1);
+}