Article View: comp.os.msdos.programmer
Article #7878Re: MS C Compiler bug
From: Robert Fry
Date: Wed, 08 Nov 1995 00:40
Date: Wed, 08 Nov 1995 00:40
35 lines
1610 bytes
1610 bytes
Eric Prebys <prebys@puhep1.princeton.edu> writes:
>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).
I haven't looked at MS C for over a year, but I would think the problem
has to do with that large item being allocated /on the stack/. If I'm
remembering correctly, your compiler manual will tell you how to change
the default size of the stack (which is normally quite small).
You may also want to consider putting that array outside of the stack,
either as a static global or a dynamically allocated value (on the heap).
Each solution has its advantages, depending on what you're doing.
Bob
Technical Details
Message-ID:
<47ou9l$5o9@crl.crl.com>Path:
arc1-ca.pugleaf.net!crl.crl.com!not-for-mailReferences:
<47oaiq$b02@cnn.Princeton.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!crl.crl.com!not-for-mail From: bobfry@crl.com (Robert Fry) Newsgroups: comp.os.msdos.programmer,comp.lang.c Subject: Re: MS C Compiler bug Date: 7 Nov 1995 16:40:21 -0800 Organization: CRL Dialup Internet Access Message-ID: <47ou9l$5o9@crl.crl.com> References: <47oaiq$b02@cnn.Princeton.EDU> NNTP-Posting-Host: crl.com