This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/46675] [4.6 Regression] profiledbootstrap failed
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 27 Nov 2010 20:13:07 +0000
- Subject: [Bug tree-optimization/46675] [4.6 Regression] profiledbootstrap failed
- Auto-submitted: auto-generated
- References: <bug-46675-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46675
--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-27 20:12:44 UTC ---
The bug seems to be:
Visiting PHI node: i_1950 = PHI <i_1028(291), i_224(510)>
Argument #0 (291 -> 503 executable)
i_1028
Value: [0, 0]
Argument #1 (510 -> 503 executable)
i_224
Value: [1, 2]
(analyze_scalar_evolution
(loop_nb = 16)
(scalar = i_1950)
(get_scalar_evolution
(scalar = i_1950)
(scalar_evolution = {0, +, 1}_16))
(set_scalar_evolution
instantiated_below = 291
(scalar = i_1950)
(scalar_evolution = {0, +, 1}_16))
)
(instantiate_scev
(instantiate_below = 291)
(evolution_loop = 16)
(chrec = {0, +, 1}_16)
(res = {0, +, 1}_16))
i_1950: loop information indicates does not overflow
(analyze_scalar_evolution
(loop_nb = 16)
(scalar = i_1950)
(get_scalar_evolution
(scalar = i_1950)
(scalar_evolution = {0, +, 1}_16))
(set_scalar_evolution
instantiated_below = 291
(scalar = i_1950)
(scalar_evolution = {0, +, 1}_16))
)
(instantiate_scev
(instantiate_below = 291)
(evolution_loop = 16)
(chrec = {0, +, 1}_16)
(res = {0, +, 1}_16))
Found new range for i_1950: [0, 0]
while the previous range was i_1950: [0, 1]
This means that number of iteration analysis has gone wrong.
Analyzing # of iterations of loop 16
exit condition [1, + , 1](no_overflow) < n_1968 - -2147483648
bounds on difference of bases: 0 ... -2
result:
# of iterations (unsigned int) n_1968 + 2147483647, bounded by 0
Statement (exit)if (i_224 < npairs_1969)
is executed at most (unsigned int) n_1968 + 2147483647 (bounded by 0) + 1
times in loop 16.
the "bounded by 0" is why things go wrong. The original statement defining
the exit condition bound is
npairs_1969 = n_1968 - -2147483648;
Testcase:
volatile int j;
int __attribute__((noinline))
foo(int n)
{
int i = 0, npairs;
npairs = n - (- __INT_MAX__ - 1);
if (npairs > 0)
{
do
{
++j;
i = i + 1;
}
while (i < npairs);
}
return 0;
}
extern void abort (void);
int main()
{
j = 0;
foo (- __INT_MAX__ - 1 + 5);
if (j != 5)
abort ();
return 0;
}
is optimized to an endless loop by the first VRP pass.