www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/22/11:24:19

From: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Message-Id: <199707221524.AA040975050@typhoon.rose.hp.com>
Subject: Re: Weird static/dynamic allocation crash...
To: kennw AT tidalwave DOT net (Kenn White)
Date: Tue, 22 Jul 1997 8:24:10 PDT
Cc: djgpp AT delorie DOT com
In-Reply-To: <3.0.1.32.19970722035329.0069bfd4@postoffice.tidalwave.net>; from "Kenn White" at Jul 22, 97 3:53 am

> It seems that when the integer x is forceably set (i.e.,
> statically allocated)
Not quite.  Variables are only statically allocated if the are 
declared globally or with the static keyword.  You are doing neither,
which means it will be automatically allocated from the stack.

> int main(void) {
> 
> #ifdef STRANGE
>  int a, x[SIZE];
> #endif

> Stack Fault at eip=00001571
So it stack faults.  DJGPP uses a fixed size stack.  You are overrunning
it.  You can use stubedit on your executable to increase the stack size
or just use the malloc method.


--
_______       ___________________________________________________________
           /                       	                  Andrew Crabtree 
          /                          	      Workgroup Networks Division 
         ____       ___  /                                Hewlett-Packard 
        /     /    /    /   		                    Roseville, CA 
     __/   __/    _____/                                     916/785-1675
                 /                           andrewc AT rosemail DOT rose DOT hp DOT com
___________   __/   _____________________________________________________

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019