This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFA: Mention -fstrict-overflow/-Wstrict-overflow in changes.html
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 14 Mar 2007 09:22:14 -0700
- Subject: Re: PATCH RFA: Mention -fstrict-overflow/-Wstrict-overflow in changes.html
- References: <m3ejnrg60t.fsf@localhost.localdomain>
Ian Lance Taylor <iant@google.com> writes:
> This patch mentions -fstrict-overflow and -Wstrict-overflow in the gcc
> 4.2 changes.html file.
>
> OK to commit?
Here is an updated version which mentions that -Wall enables
-Wstrict-overflow=1 (suggested by Richard Guenther).
Ian
Index: htdocs/gcc-4.2/changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.2/changes.html,v
retrieving revision 1.23
diff -u -r1.23 changes.html
--- htdocs/gcc-4.2/changes.html 1 Feb 2007 03:09:52 -0000 1.23
+++ htdocs/gcc-4.2/changes.html 14 Mar 2007 16:21:41 -0000
@@ -28,6 +28,32 @@
supported for the C, C++ and Fortran compilers.</li>
</ul>
+<ul>
+ <li>New command line options <code>-fstrict-overflow</code> and
+ <code>-Wstrict-overflow</code> have been added.
+ <code>-fstrict-overflow</code> tells the compiler that it may
+ assume that the program follows the strict signed overflow
+ semantics permitted for the language: for C and C++ this means
+ that the compiler may assume that signed overflow does not occur.
+ For example, a loop like
+ <pre>
+ for (i = 1; i > 0; i *= 2)
+ </pre>
+ is presumably intended to continue looping until <code>i</code>
+ overflows. With <code>-fstrict-overflow</code>, the compiler may
+ assume that signed overflow will not occur, and transform this
+ into an infinite loop. <code>-fstrict-overflow</code> is turned
+ on by default at <code>-O2</code>, and may be disabled via
+ <code>-fno-strict-overflow</code>. The
+ <code>-Wstrict-overflow</code> option may be used to warn about
+ cases where the compiler assumes that signed overflow will not
+ occur. It takes five different levels:
+ <code>-Wstrict-overflow=1</code> to <code>5</code>. See the
+ <a href="http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html">
+ documentation</a> for details. <code>-Wstrict-overflow=1</code>
+ is enabled by <code>-Wall</code>.
+</ul>
+
<h3>C family</h3>
<ul>