http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55529



--- Comment #2 from Markus Trippelsdorf <markus at trippelsdorf dot de> 
2012-11-29 13:02:11 UTC ---

(In reply to comment #1)

> Why is the warning bogus?  If the loop body is executed at all, you always

> overflow the loop bounds.



Sure, but the loop is never executed in this testcase (1<0).

Also if one moves the declaration of rcu_num_lvls into the function,

gcc doesn't warn:



markus@x4 tmp % cat test.i

int *level[1];

void

fn1 ()

{

    int i;

    int rcu_num_lvls=0;

    for (i = 1; i < rcu_num_lvls; i++)

        level[i] = level[i - 1];

}

markus@x4 tmp % gcc -Wall -O2 -c test.i

markus@x4 tmp %

Reply via email to