tree-optimization/108357 - add testcase

Message ID 20230327122349.4136E13482@imap2.suse-dmz.suse.de
State Accepted
Headers
Series tree-optimization/108357 - add testcase |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Richard Biener March 27, 2023, 12:23 p.m. UTC
  The following adds the testcase for the bug which was recently
fixed.

Pushed.

	PR tree-optimization/108357
	* gcc.dg/tree-ssa/pr108357.c: New testcase.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr108357.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr108357.c
  

Patch

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr108357.c b/gcc/testsuite/gcc.dg/tree-ssa/pr108357.c
new file mode 100644
index 00000000000..44c457b7a97
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr108357.c
@@ -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" } } */