[comp.sys.ibm.pc] MSC compiler stack overflow

lotto@wjh12.HARVARD.EDU (Jerry Lotto) (06/18/87)

In article <4283@ihlpa.ATT.COM> vkar@ihlpa.ATT.COM (Thayalan) writes:
>I have the Micro-Soft C compiler version 4.0. And I am
>trying to compile a program with lots of strings.
>The compiler is running out of stack space ( please note:
>its not my program but the compiler "msc.exe" that's having
>the problem). 
>When msc.exe is started the value of SP=0080h, which tells
>me that 80h bytes are allocated for stack. I also checked
>the msc.exe from version 3.0 and it has a stack space of
>800h. This program compiles without any problem with the
>version 3.0 compiler.

Look at the program EXEMOD distributed with your compiler.  One of
it's (few) functions is to modify the .EXE header initial stack
pointer. Use this on MSC.EXE (or whatever, see caveat below) to
allocate more stack space on startup.

An aside: Check out what image is actually giving you the problem. I
ran into this with a previous version of uSoft C and was confused by
the fact that I was using the CL front end. Someone finally posted a
switch that got CL to echo its args to each exec to the command line.
This switch was undocumented as has changed since I last tried it.
Anyway, it permitted me to see the command line overflow, as well as
the specific pass of the compiler that was running out of stack space.
The image that needed that patch was C2.EXE (I think) NOT CL.EXE.
MSC.EXE is also a front end to the specific pass images. It is
probably not MSC.EXE that is ginving you this problem.

PS - Does anyone know what this switch is under 4.0?
-- 
Gerald Lotto - Harvard Chemistry Dept.
UUCP:  {seismo,harpo,ihnp4,linus,allegra,ut-sally}!harvard!lotto
ARPA:  lotto@harvard.harvard.edu

ritchie@hplsdla.HP.COM (Dave Ritchie) (06/22/87)

   Can't the stack size also be set via the /stack switch at link time?

					Dave Ritchie
					..!hplabs!hp-lsd!ritchie

geoffs@gssc.UUCP (Geoff Shapiro) (06/29/87)

In article <3540002@hplsdla.HP.COM> ritchie@hplsdla.HP.COM (Dave Ritchie) writes:
>
>
>   Can't the stack size also be set via the /stack switch at link time?

Yes, it can like so:

	C>link prog,prog,prog/stack:xxxx;

where xxxx is the # bytes in decimal (I think) to reserve for stack.

Geoff Shapiro
(503) 641-2200

singer@XN.LL.MIT.EDU (Matthew R. Singer) (06/29/87)

Posting-Front-End: GNU Emacs 18.46.1 of Fri Jun 12 1987 on xn (berkeley-unix)



Someone correct me if I'm wrong (99.9% change)....

The stack overflow message is confusing.  It can occur when:

1) the allocated stack is too small for your stack usage (local
   variables, recursion...etc)

2) the allocated stack is too big.  
   
   the size of the stack, plus the default data segment must not exceed
   64K.  so, you are sol if you need a 64K stack and want to use one
   of the standard memory models.  

   I have a program that needs a large stack (large arrays that are local
   and need to be recursive).  The only way Ive found to increase the
   size I can make the stack (via /stack in link or exemod) is to change
   the parameter which is the size at which MSC will put a data object
   in its own segment.