re PR c++/87469 (ice in record_estimate, at tree-ssa-loop-niter.c:3271)
authorKugan Vivekanandarajah <kuganv@linaro.org>
Mon, 29 Oct 2018 22:02:45 +0000 (22:02 +0000)
committerKugan Vivekanandarajah <kugan@gcc.gnu.org>
Mon, 29 Oct 2018 22:02:45 +0000 (22:02 +0000)
gcc/testsuite/ChangeLog:

2018-10-29  Kugan Vivekanandarajah  <kuganv@linaro.org>

PR middle-end/87469
* g++.dg/pr87469.C: New test.

gcc/ChangeLog:

2018-10-29  Kugan Vivekanandarajah  <kuganv@linaro.org>

PR middle-end/87469
* tree-ssa-loop-niter.c (number_of_iterations_popcount): Fix niter
max value.

From-SVN: r265605

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr87469.C [new file with mode: 0644]
gcc/tree-ssa-loop-niter.c

index 812b37aed11d5d5ea466b56b4e86a7465c19b108..35e5179762a8a8309be2e7f5afd6f34445f77f6b 100644 (file)
@@ -1,3 +1,9 @@
+2018-10-29  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       PR middle-end/87469
+       * tree-ssa-loop-niter.c (number_of_iterations_popcount): Fix niter
+       max value.
+
 2018-10-29  Paul A. Clarke  <pc@us.ibm.com>
 
        * gcc.target/powerpc/ssse3-check.h: Remove inaccurate comment.
index bfccc6038cad0273ede1774a0e345d946bfa0b46..c8e9c57e8a529cc052b20801e26dc1af5adde598 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-29  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       PR middle-end/87469
+       * g++.dg/pr87469.C: New test.
+
 2018-10-29  Marek Polacek  <polacek@redhat.com>
 
        PR c++/87594 - constexpr rejects-valid with range-based for.
diff --git a/gcc/testsuite/g++.dg/pr87469.C b/gcc/testsuite/g++.dg/pr87469.C
new file mode 100644 (file)
index 0000000..2f6de97
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-c -w -O2"  } */
+long a;
+struct c {
+    void d(unsigned f) {
+       long e = f;
+       while (e & (e - 1))
+         e &= e - 1;
+       a = e;
+    }
+};
+void g() {
+    c b;
+    b.d(4 + 2);
+}
index e2bc936ed52b9fb2f3cb675f564df8c1958ac812..e763b35ee844ae187760f9ff8a62ec51a22cd290 100644 (file)
@@ -2589,11 +2589,9 @@ number_of_iterations_popcount (loop_p loop, edge exit,
   if (TREE_CODE (call) == INTEGER_CST)
     max = tree_to_uhwi (call);
   else
-    {
-      max = TYPE_PRECISION (TREE_TYPE (src));
-      if (adjust)
-       max = max - 1;
-    }
+    max = TYPE_PRECISION (TREE_TYPE (src));
+  if (adjust)
+    max = max - 1;
 
   niter->niter = iter;
   niter->assumptions = boolean_true_node;