Bug (?) with code

Martin Vogt m_vogt@informatik.uni-kl.de
Sat May 10 11:46:00 GMT 2003


Hello,

I dont know if its a gcc bug, or an expected behaviour.
At least the program segfaults on 
gcc 3.3 (SuSe 8.2) gcc 2.95.3 (SuSe 8.1) 
and gcc 2.7.2 (unknown)

#define MAX 11000

double A[MAX][MAX];

int main(int ac, char **av){
  A[0][0]=1;
  A[MAX-1][MAX-1]=1;
  printf("Hello MAX=%d\n",MAX*MAX*8);
  getchar();
  return 0;
}

You need enough swap, but the machines all have 4GB swap
and the allocatec matrix only uses 800 MB.
If you set MAX to 10000 it works (on machines with enough swap)
with 11000 it segfaults.

regards,

Martin





More information about the Gcc-bugs mailing list