X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:to:references:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=kNq95rLvvSUy6/fc
	ealOFpQbtVwC7rXuANKyZQdXR8+ewusXXbBLv4NJv3yphR6AN0JcMTvkMmYJvtZj
	0qY5+XpR3RHa4cZDuEkVLr8U9goy2Wmw0DqNyAMeDtnnbfNRzP2gqnij59CJWAiv
	SQndywpe7LDONVblWF7l7Hy+4ig=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:to:references:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=s/sX1UNan3N1l0e+dfN2J8
	mpFaY=; b=gb8XegqM7OFKeOrKftYQLymG4kN1PZne7N5iTXBgrwry8zg3l+xxR9
	cMJ33PtRECFwOjqxSeTj78lwfo/EN6a/nJcmNWbe5Ab8byGm49jy6GbfP7GVDXJN
	pD12+nAb303R4s98LQQtKRb7/+maAX5IeicWyQnVZWJQgXXXfjrMc=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=mine, HX-Languages-Length:995
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss@cs.umass.edu
Subject: Re: My C arrays are too large
To: cygwin@cygwin.com
References: <CY4PR1101MB21339312E8F5656D8C887BFE81B30@CY4PR1101MB2133.namprd11.prod.outlook.com>
From: Eliot Moss <moss@cs.umass.edu>
Message-ID: <870fc8d4-4816-26b1-0b1f-3ed0aaa456f0@cs.umass.edu>
Date: Fri, 13 Sep 2019 08:18:23 -0400
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: <CY4PR1101MB21339312E8F5656D8C887BFE81B30@CY4PR1101MB2133.namprd11.prod.outlook.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

On 9/13/2019 8:10 AM, Blair, Charles E III wrote:
> 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<stdio.h>
> int main(){char *a[50][8192];
> return 0;}
> 
> compiles with gcc  (no special options) but gives "Segmentation fault".

Ah, it's a local variable, which means it's going on your stack.
Have you set a stack size limit that's large enough?  On my system
ulimit -a will report all the limits, and ulimit -s can be used to
set the stack limit.

In my 64-bit cygwin, ulimit -a reports a stack size of 2032 K bytes.
Your structure will be 50 * 8K * 8 = 3200 K bytes.  So if your setup
is similar to mine, your tack isn't big enough.  If you declared the
array outside of main so that it is global and in the bss area, if
would probably work out of the box, but adjusting your stack size
should fix your problem, I believe.

Regards - EM

--
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

