Greetings,
I'm running gcc on the latest Ubuntu(Edgy) and I get segfault with the
following program:

<snip>
#include <stdio.h>
#include <limits.h>

#define SIZE (INT_MAX>>3)

int main()
{
       int arr[SIZE];
       printf("%d\n",SIZE);
       return 0;
}
</snip>

bash$  gcc --version
gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bash$ gcc -Wall arr.c
arr.c: In function 'main':
arr.c:8: warning: unused variable 'arr'

bash$ ./a.out
Segmentation fault (core dumped)

I'm little surprised, why should it segfault. And especially when gcc
doesn't give any error or warning at the time of compilation (I could
use arr[o]=0, to remove the existing warning, but the error still
exists)

Regards,
Gowri Kumar

Reply via email to