This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix -O0 documentation


The documentation for -O0 says 'do not optimize'.  Although this is
partly true from a compiler implementation perspective, it isn't
helpful to users; it would imply that there is such a thing as
'unoptimized code', which is not the case, or at least GCC does not
generate it; GCC could certainly generate code that is much worse than
it does now even at -O0.  It is also untrue in some ways, for example
GCC will allocate variables in registers at -O0 which is an
optimisation, and GCC will perform constant folding at -O0.

So, this patch replaces it with a summary of the wording just above,
which reads

> Without any optimization option, the compiler's goal is to reduce the
> cost of compilation and to make debugging produce the expected
> results.  Statements are independent: if you stop the program with a
> breakpoint between statements, you can then assign a new value to any
> variable or change the program counter to any other statement in the
> function and get exactly the results you would expect from the source
> code.

which is much more correct, and is what the compiler actually does.

Bootstrapped on powerpc-darwin8.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-doc-O0.patch==========================
2007-01-08  Geoffrey Keating  <geoffk@apple.com>

	* doc/invoke.texi (Optimize Options): Correct description of -O0.

Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 120594)
+++ doc/invoke.texi	(working copy)
@@ -4623,7 +4623,8 @@
 
 @item -O0
 @opindex O0
-Do not optimize.  This is the default.
+Reduce compilation time and make debugging produce the expected
+results.  This is the default.
 
 @item -Os
 @opindex Os
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]