This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: GCC bug? Compiled code gives seg. fault
- To: Sunjay Bhatnagar <sanjay at ncra dot tifr dot res dot in>
- Subject: Re: GCC bug? Compiled code gives seg. fault
- From: Martin Kahlert <martin dot kahlert at infineon dot com>
- Date: Mon, 18 Sep 2000 08:50:36 +0200
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <14789.38072.928517.104745@tula.ncra.tifr.res.in>
- Reply-To: martin dot kahlert at infineon dot com
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.