https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26939
--- Comment #25 from Andrew Pinski ---
In GCC 4.7 (and above), we get:
Analyzing # of iterations of loop 2
exit condition [1, + , 1](no_overflow) <= i1_6(D)
bounds on difference of bases: -1 ... 2147483646
result:
under assumptions i1_
--- Comment #24 from dimhen at gmail dot com 2010-07-18 12:56 ---
is this the same problem? -- 'i*2 < 35' can't overflow
void
foo(char *ptr, unsigned size)
{
unsigned i;
for(i=0; i*2 < size && i*2 < 35; i++ ) {
*ptr++ = 0;
}
}
# gcc -Wunsafe-loop-optimizations -O3
--- Comment #23 from rguenther at suse dot de 2009-02-18 09:34 ---
Subject: Re: loop number of iterations analysis
not working
On Wed, 18 Feb 2009, rakdver at kam dot mff dot cuni dot cz wrote:
>
>
> --- Comment #21 from rakdver at kam dot mff dot cuni dot cz 2009-02-18
> 04:
--- Comment #22 from rakdver at gcc dot gnu dot org 2009-02-18 04:47
---
(In reply to comment #21)
> Subject: Re: loop number of iterations analysis not working
>
> > If the program terminates before i would wrap, then the number of
> > iterations was not MAXINT.
> > And since it can'
--- Comment #21 from rakdver at kam dot mff dot cuni dot cz 2009-02-18
04:11 ---
Subject: Re: loop number of iterations analysis not working
> If the program terminates before i would wrap, then the number of
> iterations was not MAXINT.
> And since it can't wrap, it is not infinite i
--- Comment #20 from dberlin at gcc dot gnu dot org 2009-02-18 02:54
---
Subject: Re: loop number of iterations analysis
not working
If the program terminates before i would wrap, then the number of
iterations was not MAXINT.
And since it can't wrap, it is not infinite in any
--- Comment #19 from rakdver at gcc dot gnu dot org 2009-02-18 00:50
---
> Smaller testcase:
>
> void bar();
> void foo(int i1)
> {
> int i;
>
> for (i=0; i<=i1; ++i)
> bar();
> }
What the # of iterations analysis does is the following:
-- the number of iterations is i1, unles
--- Comment #18 from rakdver at gcc dot gnu dot org 2009-02-12 19:58
---
> It "works" once you change the loop exit condition to i < i1. Same effects
> with unsigned variables (adjust the lower bound to sth like 2 to avoid ill
> effects).
There is nothing to fix if unsigned variables
--
rakdver at gcc dot gnu dot org changed:
What|Removed |Added
AssignedTo|unassigned at gcc dot gnu |rakdver at gcc dot gnu dot
|dot org
--- Comment #17 from rguenth at gcc dot gnu dot org 2009-02-08 14:45
---
The situation is still worse than originally reported. Even without PRE we
have
Analyzing # of iterations of loop 2
exit condition [1, + , 1] <= i1_6(D)
bounds on difference of bases: -1 ... 2147483646
resu
10 matches
Mail list logo