From: "Salvador Eduardo Tropea (SET)" To: jano AT arctic DOT nmt DOT edu, djgpp AT delorie DOT com Subject: Re: + 14649 optomizing cracks my code! Date: Wed, 30 Oct 1996 15:24:12 +0300 (GMT) Message-ID: <9610301524.aa00867@ailin.inti.edu.ar> Hi John: >>I've been working with some VESA 2.0 functions and I've gotten a >>putpixel function to use the protected mode interface but whenever I use >>the -O? switch the code no longer works! What's wrong. Here's a >>snippet of the code... > I have had similar problems, and am most interested in what the problem >may be. I am trying to compile a library with optimazition, and it compiles fine. >But when I compile other programs that use the library, they also compile fine but >crash at run time. There are a lot of reasons for these problems. I don't know if my experience can help you, but some time ago I had these problems, searching the reason in the assembler output (there no other way to find a problem like this) I found that the problem was MY fault, some of my routines (in asm) destroyed the content of some register, if I didn't use -O all worked OK, but not with -O, why? easy because the compiler generates stupid code if you don't use -O (take a look), the compiler makes the code in a way that all that you putted in C is translated to asm, so the compiler reloads variables all the time, this code can't be affected by clobered registers but the optimized code YES. May be your problem is far from my problem but be careful with this. SET ******************************************************************************** Salvador Eduardo Tropea (SET) - salvador AT inti DOT edu DOT ar Work: INTI (National Institute of Industrial Technology) Sector: ICE (Electronic Control & Instrumentation) Post (Home): Curapaligue 2124 - Caseros (1678)- Buenos Aires - Argentina