From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68272 invoked by alias); 18 Sep 2019 20:40:50 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 68258 invoked by uid 89); 18 Sep 2019 20:40:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=ASBESTOS_BODY,AWL,BAYES_00,SPF_PASS autolearn=no version=3.3.1 spammy=III, suit, charles, bg X-HELO: mailsrv.cs.umass.edu Received: from mailsrv.cs.umass.edu (HELO mailsrv.cs.umass.edu) (128.119.240.136) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Sep 2019 20:40:49 +0000 Received: from [10.3.40.182] (thingy.cs.umass.edu [128.119.40.196]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id 7FAF84055DEC; Wed, 18 Sep 2019 16:40:47 -0400 (EDT) Reply-To: moss@cs.umass.edu Subject: Re: My C arrays are too large To: cygwin@cygwin.com References: <87ftl0jb1i.fsf@Rainer.invalid> From: Eliot Moss Message-ID: Date: Wed, 18 Sep 2019 20:46:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-2022-jp; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00198.txt.bz2 On 9/18/2019 4:35 PM, Jose Isaias Cabrera wrote: > > Joel Rees, on Wednesday, September 18, 2019 02:38 PM, wrote... >> >> 2019年9月14日(土) 3:50 Jose Isaias Cabrera, on >>Moss >>> Achim Gratz, on Friday, September 13, 2019 02:39 PM, wrote... >>>> >>>> Blair, Charles E III writes: >>>>> My apologies for failing to reply on-list. I don't know how :( >>>>> >>>>> My machine is 64 bit, and I hope I installed the correct version of >>> cygwin. >>>>> >>>>> This program: >>>>> >>>>> #include >>>>> int main(){char *a[50][8192]; >>>>> return 0;} >>>>> >>>>> compiles with gcc (no special options) but gives "Segmentation fault". >>>> >>>> You are creating an automatic variable that's larger than the default >>>> stack. You need to enlarge the stack, either during link time or later >>>> e.g. via >>>> >>>> peflags -x0x800000 a.out >>> >>> This is great! Thanks. >>> >>> But, let's talk about this a bit... Shouldn't the compiler provide some >>> warning, and also, it should never blow up with a "Segmentation fault". I >>> believe there should be some type of Out Of Memory error, or something like >>> it. But now just blow up. Anyone thinks like me? Just my 102 Dominican >>> cents ($1 = $51 Dominican). :-) >>> >> >> Well, the behavior of the compiler itself is better discussed on the >> compiler's forums, although you may need your asbestos suit when you do so. >> >> That said, why do you want this variable to be automatic? Why do you want >> it allocated on the stack? > > I did not say automatically. I said that the compiler should provide some warning about the allocation being larger than the default stack. And, it should not result in a segmentation fault, but instead, the program should error out with out of memory, or, at least, "memory allocation is larger than default stack." Not just blow up. Automatic here means "stack allocated" (the "auto" keyword in C, which is almost always omitted because it is the default). Cheers - Eliot Moss -- 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