diff mbox

[doc] Document -fsanitize=signed-integer-overflow

Message ID 20131128123224.GH31608@redhat.com
State New
Headers show

Commit Message

Marek Polacek Nov. 28, 2013, 12:32 p.m. UTC
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.


	Marek

Comments

Marek Polacek Dec. 5, 2013, 9:50 a.m. UTC | #1
Ping.  The implementation has been commited.

On Thu, Nov 28, 2013 at 01:32:24PM +0100, Marek Polacek wrote:
> 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
Jeff Law Dec. 5, 2013, 8:54 p.m. UTC | #2
On 12/05/13 02:50, Marek Polacek wrote:
> Ping.  The implementation has been commited.
>
> On Thu, Nov 28, 2013 at 01:32:24PM +0100, Marek Polacek wrote:
>> 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.
OK.
Jeff
Jeff Law Dec. 6, 2013, 3:52 a.m. UTC | #3
On 12/05/13 02:50, Marek Polacek wrote:
> Ping.  The implementation has been commited.
>
> On Thu, Nov 28, 2013 at 01:32:24PM +0100, Marek Polacek wrote:
>> 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.
OK.
Jeff
diff mbox

Patch

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