public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: A simple program with a large array segfaults
       [not found]   ` <526520db0701040849n6845e5bdqe6c9313cb010a091@mail.gmail.com>
@ 2007-01-04 16:52     ` Andrew Haley
  0 siblings, 0 replies; only message in thread
From: Andrew Haley @ 2007-01-04 16:52 UTC (permalink / raw)
  To: Gowri Kumar CH; +Cc: Andrew Pinski, gcc-help

[redirected to gcc-help]

Gowri Kumar CH writes:
 > Hi andrew,
 > >You just overflowed your stack.  Increase the stack size for the program
 > > by using limit/ulimit or use dynamic allocated memory.
 > Thanks for the quick reply. By changing the size of the stack the
 > error goes away.
 > 
 > Is this one of the things which we come to know by experience?
 > Or
 > Is there a way to find it out from the core/code generated?
 > This was a simple program with just a few lines. I'm wondering how
 > difficult it would be find this sort of errors in a large program.
 > 

It's just something you learn not to do.  Small data on the stack,
large data on the heap.

Andrew.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-04 16:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <526520db0701040411y7c7af69es51c99aaa091e063d@mail.gmail.com>
     [not found] ` <200701041218.l04CIpc9027245@localhost.localdomain>
     [not found]   ` <526520db0701040849n6845e5bdqe6c9313cb010a091@mail.gmail.com>
2007-01-04 16:52     ` A simple program with a large array segfaults Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).