This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lno] Loop miscompilation


Hello,

> this test case is extracted from gnugo. No problem with tree-ssa or
> other gccs.

which architecture?

Nothing of the new loop optimization framework is active by default, 
so hopefully it might just go away at the next merge.

Zdenek

> gcc (GCC) 3.5-tree-ssa-lno 20040314 (merged 20040221)
> 
> % gcc bla.c && ./a.out && echo --- &&  gcc -O2 bla.c && ./a.out
> i = 0 j = 0 queue1[0] = 17
> i = 0 j = 1 queue1[0] = 17
> i = 0 j = 2 queue1[0] = 17
> i = 0 j = 3 queue1[0] = 17
> i = 0 j = 0 queue1[0] = 17
> i = 0 j = 1 queue1[0] = 17
> i = 0 j = 2 queue1[0] = 17
> i = 0 j = 3 queue1[0] = 17
> ---
> i = 0 j = 0 queue1[0] = 0
> i = 0 j = 1 queue1[0] = 0
> i = 0 j = 2 queue1[0] = 0
> i = 0 j = 3 queue1[0] = 0
> 
> 
> #include <stdio.h>
> #include <stdlib.h>
> 
> int main(void)
> {
>   int *state_to;
>   int *state_from;
>   int *queue1;
>   int *queue2;
>   int *tempq;
>   int next_new_state;
>   int q1p;
>   int q2p;
>   int i, j;
> 
>   state_to = calloc(100, sizeof(int));
>   state_from = calloc(100, sizeof(int));
> 
>   queue1 = malloc((100) * sizeof(int));
>   queue2 = malloc((100) * sizeof(int));
>   q1p = 1;
>   q2p = 0;
>   queue1[0] = 17;
>   state_from[0] = state_to[0] = 0;
>   state_from[1] = state_to[1] = 1;
>   next_new_state = 2;
> 
>   while (q1p) {
>     for (i = 0; i < q1p; i++) {
>       for (j = 0; j < 4; j++) {
> 	fprintf(stderr, "i = %d j = %d queue1[%d] = %d\n", i, j, i, queue1[i]);
>         int n = queue1[i];
>         if (n && !state_to[n]) {
>           state_to[n] = next_new_state;
>           state_from[next_new_state] = n;
>           next_new_state++;
>           queue2[q2p++] = n;
>         }
>       }
>     }
>     tempq = queue1;
>     queue1 = queue2;
>     queue2 = tempq;
>     q1p = q2p;
>     q2p = 0;
>   }
> 
>   return 0;
> }
> 
> 
> -- 
> 	Falk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]