]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/108357 - add testcase
authorRichard Biener <rguenther@suse.de>
Mon, 27 Mar 2023 12:22:56 +0000 (14:22 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 27 Mar 2023 12:24:01 +0000 (14:24 +0200)
The following adds the testcase for the bug which was recently
fixed.

PR tree-optimization/108357
* gcc.dg/tree-ssa/pr108357.c: New testcase.

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

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr108357.c b/gcc/testsuite/gcc.dg/tree-ssa/pr108357.c
new file mode 100644 (file)
index 0000000..44c457b
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-threadfull1" } */
+
+static char b;
+static unsigned c;
+void foo();
+short(a)(short d, short e) { return d * e; }
+static short f(short d) {
+  b = 0;
+  if ((d && 0 >= c < d) ^ d)
+    ;
+  else
+    foo();
+  return d;
+}
+int main()
+{
+  short g = a(5, b ^ 9854);
+  f(g);
+}
+
+/* { dg-final { scan-tree-dump-not "foo" "threadfull1" } } */