From 5efd9f170a4d9e1d8ca81312f1cc9371b1a99232 Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Mon, 29 Oct 2018 22:02:45 +0000 Subject: [PATCH] re PR c++/87469 (ice in record_estimate, at tree-ssa-loop-niter.c:3271) gcc/testsuite/ChangeLog: 2018-10-29 Kugan Vivekanandarajah PR middle-end/87469 * g++.dg/pr87469.C: New test. gcc/ChangeLog: 2018-10-29 Kugan Vivekanandarajah PR middle-end/87469 * tree-ssa-loop-niter.c (number_of_iterations_popcount): Fix niter max value. From-SVN: r265605 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/pr87469.C | 15 +++++++++++++++ gcc/tree-ssa-loop-niter.c | 8 +++----- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pr87469.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 812b37aed11..35e5179762a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-29 Kugan Vivekanandarajah + + PR middle-end/87469 + * tree-ssa-loop-niter.c (number_of_iterations_popcount): Fix niter + max value. + 2018-10-29 Paul A. Clarke * gcc.target/powerpc/ssse3-check.h: Remove inaccurate comment. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bfccc6038ca..c8e9c57e8a5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-10-29 Kugan Vivekanandarajah + + PR middle-end/87469 + * g++.dg/pr87469.C: New test. + 2018-10-29 Marek Polacek 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 index 00000000000..2f6de974859 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr87469.C @@ -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); +} diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index e2bc936ed52..e763b35ee84 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -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; -- 2.30.2