Message-Id: <3.0.1.32.19970722035329.0069bfd4@postoffice.tidalwave.net> Date: Tue, 22 Jul 1997 03:53:29 -0400 To: mailto: From: Kenn White Subject: Weird static/dynamic allocation crash... Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk Hello DJGPP gurus. Here's a strange one for you. I'm having trouble with the *very* simple program below. It seems that when the integer x is forceably set (i.e., statically allocated), I get a run-time crash. When is is malloced, however, everything is fine. I have tried changing the command.com /e: to as high as 32768, with no luck. Any ideas? Kenn White kennw AT tidalwave DOT net System: Gateway P-120 w/ 24MB RAM, Windows 95 full-screen DOS Window DPMI memory available: 17447 Kb DPMI swap space available: 4113 Kb TMP=C:\WINDOWS\TEMP TEMP=C:\WINDOWS\TEMP PROMPT=$p$g winbootdir=C:\WINDOWS COMSPEC=C:\COMMAND.COM PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\;C:\NORTON95;C:\DJGPP\BIN; SOUND=c:\CREATIVE MIDI=SYNTH:1 MAP:E MODE:0 DJGPP=C:\DJGPP\DJGPP.ENV windir=C:\WINDOWS BLASTER=A220 I5 D1 H5 P330 T6 E620 ******************************************** #include #include #define SIZE 1000000 #define STRANGE int main(void) { #ifdef STRANGE int a, x[SIZE]; #endif #ifndef STRANGE int a, *x; x=malloc(SIZE*sizeof(int)); if (x==NULL) { printf("Malloc fail.\n"); exit(0); } printf("Passed malloc \n"); #endif for (a=0; aq Exiting due to signal SIGSEGV Stack Fault at eip=00001571 eax=00000000 ebx=00142160 ecx=00000000 edx=0000033e esi=00000054 edi=0000c4d0 ebp=0013ffd4 esp=ffd6f6d0 program=C:\32C\Q.EXE cs: sel=00a7 base=82b86000 limit=0014ffff ds: sel=00af base=82b86000 limit=0014ffff es: sel=00af base=82b86000 limit=0014ffff fs: sel=0087 base=0000bfb0 limit=0000ffff gs: sel=00bf base=00000000 limit=ffffffff ss: sel=00af base=82b86000 limit=0014ffff Call frame traceback EIPs: 0x00001571 ********************************************************************* This is the output with dynamic allocation (STRANGE commented out) ********************************************************************* C:\32c>q Passed malloc Finished loop fill.