This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: main() {char data[10000000];} crashes on alpha
- To: Matthias Klose <doko at cs dot tu-berlin dot de>
- Subject: Re: main() {char data[10000000];} crashes on alpha
- From: Michael Meissner <meissner at cygnus dot com>
- Date: Thu, 25 Jan 2001 20:11:10 -0500
- Cc: gcc-bugs at gcc dot gnu dot org, 65364 at bugs dot debian dot org
- References: <14960.46017.923278.219959@gargle.gargle.HOWL>
On Fri, Jan 26, 2001 at 12:16:17AM +0100, Matthias Klose wrote:
> [ http://bugs.debian.org/65364 submitted to the Debian BTS;
> please CC 65364@bugs.debian.org on replies]
>
> same behaviour at least in CVS 20010102.
>
> falk@borkum:~/src/pq% cat bug.c
> int main() {
> char data[10000000];
>
> return 0;
> }
> falk@borkum:~/src/pq% gcc bug.c -o bug
> falk@borkum:~/src/pq% ./bug
> zsh: segmentation fault (core dumped) ./bug
>
> Slightly less, like 5000000, works ok.
>
> I have 128 MB of memory, so that shouldn't be the problem.
>
> It also works on i386.
I suspect you need to have more stack space available. If you use bash as your
shell, do "ulimit -a" to find out your limits. If you use csh or tcsh as your
shell do "limit". If you don't have enough stack space, the program will
segfault when the main function is entered. In order to raise your stack
limit, you generally have to have a root program use setrlimit to raise the
limit, and then spawn a child (presumably non-root) which would inherit the new
limit. On some systems you won't be able to raise the limit past a given
amount.
--
Michael Meissner, Red Hat, Inc. (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482