From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130004 invoked by alias); 13 Sep 2019 23:05:42 -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 129990 invoked by uid 89); 13 Sep 2019 23:05:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=Lee, HX-Languages-Length:1603, H*r:4985, talk X-HELO: mail-qk1-f178.google.com Received: from mail-qk1-f178.google.com (HELO mail-qk1-f178.google.com) (209.85.222.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Sep 2019 23:05:40 +0000 Received: by mail-qk1-f178.google.com with SMTP id y144so21815710qkb.7 for ; Fri, 13 Sep 2019 16:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=h7/ihB62CVspHSPZdq6fxXSI5aQqW4empDSkcBy+MGg=; b=ija7h3Nhb/jbqy/UgKFfgayiiPrntXhECfIJu3yXsoCGbYWC7WFIphzygpvtFLIPF/ wCq6ghg+7sdsyZ9jnW3mVCxkl1QEze+XHv+xGMkO2rDn4avHACYSGF/9NRZ2JRGR2JSf /CxowF7RG2AB5yCLQHG+vlPDtBZR1uXHpxTT/Q/0oE3OKoKK83G1pLgkTh4pRWN3C2JE T1QmzxPW5gu2aIJA99s5IfubLyJclGysOoHtNdYVnS8E37M34tbqphCEMq0haSW+SGAn mtKesaEMX72Z1b9Xufqm/HP8GX1CF79Mc/IiZHJd0qUEZExowC151C2hIiGMA7xmlwvz 9Obw== MIME-Version: 1.0 Received: by 2002:ad4:4985:0:0:0:0:0 with HTTP; Fri, 13 Sep 2019 16:05:38 -0700 (PDT) In-Reply-To: References: <87ftl0jb1i.fsf@Rainer.invalid> From: Lee Date: Sat, 14 Sep 2019 05:32:00 -0000 Message-ID: Subject: Re: My C arrays are too large To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00170.txt.bz2 On 9/13/19, Jose Isaias Cabrera wrote: > > 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). :-) Yes, it would be nice if you got an error message. But once you notice a .stackdump file has magically appeared, then $ gcc -o a.exe starray.c $ ./a Segmentation fault (core dumped) $ cat a.exe.stackdump Exception: STATUS_STACK_OVERFLOW at rip=001004010C6 <.. snip ..> Search for "cygwin STATUS_STACK_OVERFLOW" and find https://github.com/OpenFAST/openfast/issues/144 which gives you $ gcc -o a.exe -Wl,--stack,0x1000000 starray.c $ ./a $ peflags -x a.exe a.exe: stack reserve size : 16777216 (0x1000000) bytes Regards, Lee -- 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