]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Add testcase for already fixed PR [PR99739]
authorJakub Jelinek <jakub@redhat.com>
Fri, 24 Mar 2023 08:39:59 +0000 (09:39 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 24 Mar 2023 08:39:59 +0000 (09:39 +0100)
This PR was fixed by r13-1268-g8c99e307b20, I'm adding testcase
to make sure we don't regress on it in the future.

2023-03-24  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/99739
* gcc.dg/tree-ssa/pr99739.c: New test.

gcc/testsuite/gcc.dg/tree-ssa/pr99739.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr99739.c b/gcc/testsuite/gcc.dg/tree-ssa/pr99739.c
new file mode 100644 (file)
index 0000000..3ebaa4b
--- /dev/null
@@ -0,0 +1,40 @@
+/* PR tree-optimization/99739 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-not "__builtin_abort \\\(\\\);" "optimized" } } */
+
+static inline int
+foo (int i, int j, int k)
+{
+  int x = 1;
+  if (i && j && k)
+    x = 2;
+  if (i && j && k)
+    return x;
+  return -1;
+}
+
+void
+bar (int i, int j, int k)
+{
+  if (foo (i, j, k) == 1)
+    __builtin_abort ();
+}
+
+static inline int
+baz (int i, int j, int k)
+{
+  int x = 1;
+  if (i && j && k)
+    x = 2;
+  if (i && k && j)
+    return x;
+  return -1;
+}
+
+void
+qux (int i, int j, int k)
+{
+  if (baz (i, j, k) == 1)
+    __builtin_abort ();
+}