From: wmcgugan AT netcomuk DOT co DOT uk (William McGugan) Newsgroups: comp.os.msdos.djgpp Subject: Re: Crashes with -O Date: Sat, 10 May 1997 19:14:06 GMT Organization: None. (via NETCOM Internet Ltd. USENET service). Lines: 21 Message-ID: <33416b32.165818@nntp.netcomuk.co.uk> References: <33407c18 DOT 79366 AT nntp DOT netcomuk DOT co DOT uk> NNTP-Posting-Host: dialup-17-07.netcomuk.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Sat, 10 May 1997 02:09:58 GMT, wmcgugan AT netcomuk DOT co DOT uk (William McGugan) wrote: >I have a function that crashes with the -O switch set (any value). >What could cause that, and how can I cure it? > Problem solved :) I had a loop that changed some global variables and called an assembler function that used these global variables. I think that when the optimizations were on the compiler used registers instead of memory references, so the correct values were in registers and not in memory where the assembler function expected them to be. Of course, I'm only guessing but I coded the loop completely in assembler and everything works fine now. William McGugan. http://www.netcomuk.co.uk/~wmcgugan