🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #7876

Re: MS C Compiler bug

#7876
From: John R Buchan (jatmon)
Date: Wed, 08 Nov 1995 04:42
36 lines
1730 bytes
In article <47oaiq$b02@cnn.Princeton.EDU>, prebys@puhep1.princeton.edu says...
>
>
>We are compiling software on a 486 using the Microsoft C compiler,
>version 7.0.  The following program
>
>=========================================================
>int main(int, char **);
>
>int main(int argc, char **argv)
>{
>float aaabbb[2][500];
>exit(0);
>}
>==========================================================
>
>compiles, but causes the error
>
>R6000 - stack overflow
>
>when run.  The problem goes away if the array is made smaller, but
>this array shouldn't cause any problems.  Does anyone have any 
>suggestions?  The problem is independent of which memory model
>I use or whether or not I try to initialize the array (or
>any other switch or operation I can think of).

Assuming sizeof(float) == 4, you array definition is pushing 4000 bytes 
on the stack.  This apparently exceeds your stack size.  The simplest 
solution is to make the array static.  Either use the static storage 
specifier or move the definition outside of main to make it global. You
could, alternatively, use a dynamic array or look through your compiler's
docs for a method to change the stack size.

-- 
John R Buchan           -:|:-     Looking for that elusive FAQ?  ftp to:
jatmon@mail.iag.net     -:|:-     rtfm.mit.edu /pub/usenet-by-group/....
Technical Details
Message-ID: <47pcg3$be3@news.iag.net>
Path: arc1-ca.pugleaf.net!news.iag.net!usenet
References: <47oaiq$b02@cnn.Princeton.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.iag.net!usenet
From: jatmon@iag.net (John R Buchan (jatmon))
Newsgroups: comp.os.msdos.programmer,comp.lang.c
Subject: Re: MS C Compiler bug
Date: 8 Nov 1995 04:42:43 GMT
Organization: Internet Access Group, Orlando, Florida
Message-ID: <47pcg3$be3@news.iag.net>
References: <47oaiq$b02@cnn.Princeton.EDU>
NNTP-Posting-Host: pm2-orl5.iag.net