X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Date: Fri, 9 Dec 2011 18:02:08 +0100 From: Denis Excoffier To: cygwin AT cygwin DOT com Subject: Re: gcc-4.5.3 segfaults wrt alloca Message-ID: <20111209170232.GA6452@po8371> References: <20111209105801 DOT GA10388 AT po8371> <4EE22156 DOT 4080402 AT cs DOT utoronto DOT ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EE22156.4080402@cs.utoronto.ca> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Fri, Dec 09, 2011 at 09:55:18AM -0500, Ryan Johnson wrote: >> 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. You're right. % ulimit -a core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited open files (-n) 256 pipe size (512 bytes, -p) 8 stack size (kbytes, -s) 2034 cpu time (seconds, -t) unlimited max user processes (-u) 256 virtual memory (kbytes, -v) unlimited % ulimit -s 3000 sh: ulimit: stack size: cannot modify limit: Invalid argument % Regards, Denis Excoffier. -- 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