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]

segmentation fault befor beginning of programs


With the following version of gcc
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs
gcc version 2.95.3 19991030 (prerelease)

the program
int main(int argc, char **argv)
{
  int i,j,k;
  double densite_reduite[100][25][25];
  double densite_espace[100][100][100];
  
  for(i=0;i<100;i++)
    for(j=0;j<25;j++)
       for(k=0;k<25;k++)
          densite_reduite[i][j][k]=0; 
  for(i=0;i<100;i++)
    for(j=0;j<100;j++)
       for(k=0;k<100;k++)
          densite_espace[i][j][k]=0;
  return 0;

}

compiled with gcc -Wall essai.c -o essai -g
give a segmentation fault:

gdb essai core
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i586-mandrake-linux"...
Core was generated by `essai'.
Program terminated with signal 11, Erreur de segmentation.
Reading symbols from /usr/share/chinese/xa+cv/cv.so...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /lib/ld-linux.so.2...done.
#0  0x80483c9 in main (argc=1, argv=0xbffffaf4) at essai.c:2
2       {




  Even if I have made an error in my code I don't understand why I can't
see where the code cause a segfault.

NB: 
_ If  I replace densite_reduite[100][25][25] 
by densite_reduite[25][25][25] there is no error.
_ There is the same problems with  pgcc-2.91.66 19990314 (egcs-1.1.2 
release) under linux but not with gcc -2.95.2 under solaris.


Fabrice BOYRIE



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