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]

[PATCH] Clarify that -fwrapv covers all signed arithmetic overflow


GCC's -fwrapv option does not affect code generation for shifts
because currently GCC does not rely on the fact that certain
signed shifts trigger undefined behavior.  However, the definition
of signed arithmetic overflow does extend to shifts; it is only
code generation that is limited to addition, subtraction and
multiplication.

Make the documentation of -fwrapv consistent with the existing
text under -fstrict-overflow ("Using '-fwrapv' means that integer
signed overflow is fully defined: it wraps.").

Ok for trunk and the branches?

Paolo

* doc/invoke.texi (Optimize Options): Clarify the effect of -fwrapv.

Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 227511)
+++ doc/invoke.texi	(working copy)
@@ -23705,9 +23705,10 @@
 @item -fwrapv
 @opindex fwrapv
 This option instructs the compiler to assume that signed arithmetic
-overflow of addition, subtraction and multiplication wraps around
-using twos-complement representation.  This flag enables some optimizations
-and disables others.  This option is enabled by default for the Java
+overflow wraps around using twos-complement representation.
+This flag affects code generation for addition, subtraction
+and multiplication, enabling some optimizations
+and disabling others.  This option is enabled by default for the Java
 front end, as required by the Java language specification.
 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
 @option{-ftrapv} @option{-fwrapv} on the command-line results in


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