This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc-4.5.3 segfaults wrt alloca


On 09/12/2011 5:58 AM, Denis Excoffier wrote:
I use the latest packages and cygwin snapshots. The problem described
below began several snapshots in the past, around beginning of December.

The following program, with static allocation of a reasonable amount
of data, segfaults, maybe in alloca(). With a smaller size
(eg 10000) it's ok. With new/malloc (even with 100 times more) it's
ok. With C or C++. 100% reproducible.
   unsigned int const SIZE = 689471;
   int foo[SIZE];
Reasonable? You're trying to stack-allocate 2.5MB of data. Don't do that -- stack sizes are 2MB or less in most operating systems. Besides, doing anything useful with a buffer that size would completely drown out the overhead of calling malloc.

Ryan




-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple


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