Date: Wed, 23 Sep 1998 19:23:01 +0300 (IDT) From: Eli Zaretskii To: "John S. Fine" cc: djgpp AT delorie DOT com Subject: Re: Optimizations In-Reply-To: <36091D15.6B94@erols.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Wed, 23 Sep 1998, John S. Fine wrote: > In my real code, > there are function calls in most loops and those function calls > have side effects, because having those side effects happen in > the loop is the main purpose of the loop. Perhaps I should explain what I mean by ``side-effects''. A function that does not examine any values except its arguments, and has no effects except the return value, is said to have no side effects. If a function does have side effects, then GCC inhibits some optimizations in a loop that calls that function, because pointer aliasing in C can cause it to produce wrong code if it does those optimizations. > I think it is clear > that the function calls have little to do with the bad code, > because the bad code was generated even when I removed the > function calls. Sorry, I didn't understand that from your original message. > It > is a shame that GCC can't look at the results of each individual > application of that feature and notice when it is harmful rather > than helpful. You might consider talking to the GCC developers. They will probably be able to explain much better than I could how profoundly hard it is to make a compiler notice all these and many other aspects of a program. But please do talk to them anyway, since some of these problems might be genuine bugs. > For my current project, I guess I need to abandon the goal of > having a high performance 486 version and a portable C version > in the same source code (which would have helped long term > maintenance). It will be much easier to simply write the 486 > version in assembler. Maybe EGCS will produce better code, it uses a better optimization technology.