GCC bug? Compiled code gives seg. fault

Martin Kahlert martin.kahlert@infineon.com
Sun Sep 17 23:50:00 GMT 2000


I think, you run into a stack size problem.
Try 'ulimit -a' and look for the stack size limitation.

I assume, gcc -O2 works, because the program doesn't use
neither data nor dat and these variables are optimized away
completely.

Hope that helps,
Martin.

On Mon, Sep 18, 2000 at 09:36:16AM +0530, Sunjay Bhatnagar wrote:
> Hi,
> 
> I have a simple code which allocates static memory.  When compiled
> with gcc (GCC version, OS details are given below), the compiled code
> gives a segementation fault where it should not.
> 
> The code is as follows (file "xxx.c"):
> 
>   #include <stdio.h>
>   #include <string.h>
>   #include <math.h>
>   #include <stdlib.h>
> 
>   #define MAX_DATA_LEN 60000
>   #define MAX_COLUMN_NOS 120
> 
>   int main(int argc, char **argv)
>   {
>      char line[2001], *strptr;
>      float data[MAX_DATA_LEN][MAX_COLUMN_NOS];
>      float dat[MAX_DATA_LEN];
>   
>      float mean, rms, err, max, min; 
>      float sigma_max  = 3.0, thresh;
> 
>      return 0;
>   }

-- 
The early bird gets the worm. If you want something else for       
breakfast, get up later.


More information about the Gcc-bugs mailing list