Path: chuka.playstation.co.uk!news From: Chris Chadwick Newsgroups: scee.yaroze.programming.gnu_compiler Subject: Re: stack fault... still! Date: Tue, 28 Jul 1998 00:51:24 -0700 Organization: PlayStation Net Yaroze (SCEE) Lines: 48 Message-ID: <35BD82FC.2401@dial.pipex.com> References: <35B83682.2391@dial.pipex.com> <01bdb7dc$8bbdc5c0$8e9a7095@edfhome.3com.com> NNTP-Posting-Host: usern069.uk.uudial.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 2.02 (Win95; I; 16bit) Ed Federmeyer wrote: > > Chris Chadwick wrote in article > <35B83682.2391@dial.pipex.com>... > > > > OK, I still can't get a particular module in my project to compile with > > -O2 optimization. It compiles fine with -O0 and -O1 but I want it to run > as fast > > as possible because it contains functions that are called MANY times > > during the main game loop. > > > > Heres the exact error message I get... > > > > gcc -O2 -c icsal.c > > Stack Fault at eip=d5d17 > > eax=00000098 ebx=000042ec ecx=0000001c edx=000012e0 esi=002cdab8 > edi=00000001 > > ebp=001796e8 esp=0011204c cs=177 ds=16f es=16f fs=16f gs=187 ss=17f > cr2=00009fec > > Call frame traceback EIPs: > > 0x000d5d17 > > When I had this problem, it was because I had a really long function in the > file. (Normally > I try not to make grossly long functions, but this was just a test hack and > it was easier to > just keep tacking stuff onto the function. :-) Apparently, when GCC is > optimizing a big > function, it needs alot more stack space when you crank the -O level up. > > Add the DOS environment variable "GO32=dpmistack 2000000" (for example), to > give > GCC more room to work in. I have not had the problem after doing this. (I > put it in my > autoexec.bat, where all my other Yaroze-related environment variables are). > > EdF Woo-hoo! Thanks, Ed. This was the info I was originally looking for. I knew I had read about setting an environment variable in a post a few months back but couldn't find the post when I needed it. :( I'm sure you're right about needing more space to compile large functions as the module I was having trouble with does contain a couple of biggies (which I can't split into smaller functions). Cheers for the help, -Chris