From: Lee <ler762@gmail.com>
To: cygwin@cygwin.com
Subject: Re: My C arrays are too large
Date: Sat, 14 Sep 2019 05:32:00 -0000 [thread overview]
Message-ID: <CAD8GWsu80Fd7edqaC5GYZnFvkjUGdtxd6Lpg9t_WJ-uUoCv_mA@mail.gmail.com> (raw)
In-Reply-To: <VI1PR01MB44132EB2432CCD4CE1892304DEB30@VI1PR01MB4413.eurprd01.prod.exchangelabs.com>
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<stdio.h>
>> > 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
next prev parent reply other threads:[~2019-09-13 23:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-13 12:18 Blair, Charles E III
2019-09-13 12:37 ` Eliot Moss
2019-09-13 18:44 ` Achim Gratz
2019-09-13 18:50 ` Eliot Moss
2019-09-13 19:01 ` Jose Isaias Cabrera
2019-09-14 5:32 ` Lee [this message]
2019-09-18 19:09 ` Joel Rees
2019-09-18 20:40 ` Jose Isaias Cabrera
2019-09-18 20:46 ` Eliot Moss
2019-09-19 1:19 ` Joel Rees
2019-09-19 18:04 ` Jose Isaias Cabrera
2019-09-19 21:58 ` Brian Inglis
2019-09-13 13:44 my " Blair, Charles E III
2019-09-13 14:20 ` Eliot Moss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAD8GWsu80Fd7edqaC5GYZnFvkjUGdtxd6Lpg9t_WJ-uUoCv_mA@mail.gmail.com \
--to=ler762@gmail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).