DEAR  Sir : GNU 

I am writing to you regarding bug report

under this code 



#include <stdio.h>
#include <values.h>

void subroutine(int n)
{
    int buf[n];
    fprintf(stderr, "%d (%d)\n", (int)sizeof(buf), (unsigned long)buf);
}

int main( int argc, char **argv)
{
    int i, value[] = {0, 1, -1, INT_MAX, 1000000, 2092728, 2092729};

    for (i=0; i<7; i++) {
      fprintf(stderr, "%d: ", value[i]);
      subroutine(value[i]);
    }
    exit(0);
}


① gcc version 3.2.3
0: 0 (-1073762400)
1: 4 (-1073762416)
-1: -4 (-1073762400)
2147483647: -4 (-1073762400)
1000000: 4000000 (-1077762400)
2092728: 8370912 (-1082133312)
2092729: 8370916 (-1082133328)

② gcc version 2.96
0: 0 (-1073752048)
1: 4 (-1073752064)
-1: -4 (-1073752048)
2147483647: -4 (-1073752048)
1000000: 4000000 (-1077752048)
2092728: Segmentatioin error (core dumped)


There was a difference of the above-mentioned by the difference of the
version of gcc when having thoroughly examined it. Was this a bug of
version 2.96?

Sincerely yours,

EISUKE HAYASHI

Reply via email to