Path: chuka.playstation.co.uk!scea!peter_alau@playstation.sony.com From: "Ed Federmeyer" Newsgroups: scee.yaroze.programming.gnu_compiler Subject: Re: stack fault... still! Date: 25 Jul 1998 14:56:30 GMT Organization: Ed Federmeyer Lines: 36 Message-ID: <01bdb7dc$8bbdc5c0$8e9a7095@edfhome.3com.com> References: <35B83682.2391@dial.pipex.com> NNTP-Posting-Host: charlie.cns.iit.edu X-Newsreader: Microsoft Internet News 4.70.1155 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