]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add testcase for PR 83541.
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 11 Jan 2022 19:58:35 +0000 (14:58 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Wed, 12 Jan 2022 15:28:16 +0000 (10:28 -0500)
Ranger now performs this optimzation.

PR tree-optimization/83541
gcc/testsuite
* g++.dg/pr83541.C: New.

gcc/testsuite/g++.dg/pr83541.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/pr83541.C b/gcc/testsuite/g++.dg/pr83541.C
new file mode 100644 (file)
index 0000000..f5b181e
--- /dev/null
@@ -0,0 +1,17 @@
+// PR tree-optimization/83541
+// { dg-do compile }
+// { dg-options "-O3 -std=c++17 -ffast-math -fdump-tree-evrp"  }
+
+#include <limits>
+
+int test(int x)
+{
+    if(x == std::numeric_limits<int>::max())
+    {
+        return x+1;
+    }
+    return 42;
+}
+
+// { dg-final { scan-tree-dump "return 42"  evrp } }
+// { dg-final { scan-tree-dump-not "return _"  evrp } }