[comp.unix.xenix] load module errors induced by array sizes in c

scowles@lll-lcc.aRpA (Sid Cowles) (07/22/87)

i am running sco xenix 2.1.0 on an at-clone.  referring to
the code below, why does gigo1 run without errors and gigo2
produces 'Stack overflow
          Segmentation violation -- Core dumped'?
i used 'cc -o file file.c' where 'file' is gigo1 or gigo2
to compile these.

===========================================================
gigo1.c:     main() { char f[31][127]; printf("hello\n"); }
gigo2.c:     main() { char f[32][128]; printf("hello\n"); }

thanks,
sid
================================================================
s cowles
uucp:    {seismo,ihnp4,gatech}!lll-lcc!esd!scowles
arpa:    esd!scowles@lll-lcc.arpa
bitnet:  esd!scowles%lll-lcc.arpa@wiscvm.bitnet

brianc@cognos.uucp (Brian Campbell) (08/04/87)

In article <995@lll-lcc.aRpA> esd!scowles@lll-lcc.UUCP (Sid Cowles) writes:
! i am running sco xenix 2.1.0 on an at-clone.  referring to
! the code below, why does gigo1 run without errors and gigo2
! produces 'Stack overflow
!           Segmentation violation -- Core dumped'?
! i used 'cc -o file file.c' where 'file' is gigo1 or gigo2
! to compile these.
! 
! ===========================================================
! gigo1.c:     main() { char f[31][127]; printf("hello\n"); }
! gigo2.c:     main() { char f[32][128]; printf("hello\n"); }

   Same problem under  2.1.3. It seems the  _stkgro routine can't
handle increasing the stack size  by more than 4046 characters at
once. The gigo2 program expects 4096 characters of stack space.
   You  can make  this problem  "go away"  by specifying  a fixed
stack size with the -F option of cc.
-- 
Brian Campbell          uucp: decvax!utzoo!dciem!nrcaer!cognos!brianc
Cognos Incorporated     mail: 3755 Riverside Drive, Ottawa, Ontario, K1G 3N3
(613) 738-1440          fido: sysop@163/8