Article View: comp.os.os2.programmer
Article #310Re: Strange trap in IBM C
From: Matt Johnson
Date: Fri, 07 Aug 1992 07:55
Date: Fri, 07 Aug 1992 07:55
35 lines
1907 bytes
1907 bytes
IA>In article <1992Aug3.140521.14803@vela.acs.oakland.edu>,
IA>bcmatusz@vela.acs.oakland.edu (Brian Matusz) writes:
IA>>
IA>>In article <1992Aug3.111930.19189@ifi.unizh.ch> erzberg@ifi.unizh.ch (Martin
IA>zberger) writes:
IA>>
IA>>>Can anybody see what's wrong with the following piece of code? I cut it
IA>>>down from a large utility which compiles and runs fine on a SUN.
IA>>>With the IBM C Set/2 compiles, it generates a TRAP. Looking with the
IA>>>debugger, the TRAP gets generated in the initialisation phase (I think
IA>>>at the moment the library gets called to initialize).
IA>>>When I remove any of the two declarations, the program will "run" (of
IA>>>course it does nothing).
IA>>>Now here the code:
IA>>>
IA>>>#include <stdlib.h>
IA>>>
IA>>>main(int argc, char *argv[])
IA>>>{
IA>>> char *test1 = NULL;
IA>>> int test2[32768];
IA>>>}
IA>>
IA> Almost certainly insufficient stack space. Local variables reside on
IA>the stack, and the default is quite a bit smaller than 32K. Use
IA>/St:42000 on the link command line, and the program should work.
IA>Regards,
IA>Ian.
Even that won't be enough. You'll need 128k stack for the integer
array alone. Probably better to use malloc(), or make test2 global.
---
. SLMR 2.1a . Eeezz beeg trouble for moose and squirrel!
Technical Details
Message-ID:
<2184.118.uupcb@cutting.hou.tx.us>Path:
arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!menudo.uh.edu!lobster!nuchat!xcluud!cutting!matt.johnsonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!menudo.uh.edu!lobster!nuchat!xcluud!cutting!matt.johnson From: matt.johnson@cutting.hou.tx.us (Matt Johnson) Newsgroups: comp.os.os2.programmer Subject: Re: Strange trap in IBM C Message-ID: <2184.118.uupcb@cutting.hou.tx.us> Date: 7 Aug 92 07:55:00 GMT Reply-To: matt.johnson@cutting.hou.tx.us (Matt Johnson) Organization: The Cutting Edge - Houston, TX - 713-466-1525 Lines: 35