This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, doc] Document -fsanitize=signed-integer-overflow
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 28 Nov 2013 13:32:24 +0100
- Subject: [PATCH, doc] Document -fsanitize=signed-integer-overflow
- Authentication-results: sourceware.org; auth=none
As promised, this patch on top of this patch by Tobias:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg03082.html
adds the documentation for -fsanitize=signed-integer-overflow.
Ok to install after the actual implementation is in?
2013-11-28 Marek Polacek <polacek@redhat.com>
* doc/invoke.texi: Document -fsanitize=signed-integer-overflow.
--- gcc/doc/invoke.texi.mp3 2013-11-28 13:07:09.011575348 +0100
+++ gcc/doc/invoke.texi 2013-11-28 13:24:45.109798224 +0100
@@ -5341,6 +5341,19 @@ built with this option turned on will is
tries to dereference a NULL pointer, or if a reference (possibly an
rvalue reference) is bound to a NULL pointer.
+@item -fsanitize=signed-integer-overflow
+@opindex fsanitize=signed-integer-overflow
+
+This option enables signed integer overflow checking. We check that
+the result of @code{+}, @code{*}, and both unary and binary @code{-}
+does not overflow in the signed arithmetics. Note, integer promotion
+rules must be taken into account. That is, the following is not an
+overflow:
+@smallexample
+signed char a = SCHAR_MAX;
+a++;
+@end smallexample
+
@end table
While @option{-ftrapv} causes traps for signed overflows to be emitted,
Marek