public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* fix -O0 documentation
@ 2007-01-09  7:29 Geoffrey Keating
  0 siblings, 0 replies; only message in thread
From: Geoffrey Keating @ 2007-01-09  7:29 UTC (permalink / raw)
  To: gcc-patches


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
============================================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-09  7:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-09  7:29 fix -O0 documentation Geoffrey Keating

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).