From patchwork Thu Nov 28 12:32:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 294873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8A5B82C007A for ; Thu, 28 Nov 2013 23:32:48 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=uDRrtxJcV2X0A7tvhOev/xizxH1RrxtaTfj6HH0hhedK6i/cNjq1B TClw6/zyYAfQiHEDDvf6vX6KedUwTKyoZ2GTt66WmBAizoAa7daAK8wT0869yeFp +nPMXTpPqpQ0UVUGlOGV9mT6JA1KySozmaIkQM3n+oNmZsQsVrusZU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=nGt5Nmtu1CwJ0/5EZOlGelNeigk=; b=yG7TQUKpUl7pveSHvad6 yXCLzdU2qSKeTm79y+1kF70K0LOVtaAFuxRFj5UzhNe0Q9MkfwsVF3oakKiH8Maw S0h90NkzyehEL8h04rq8lM+iIWUwWARtaqtiz7Mk8XoUqXQNckdlxAGlpOags0eG NJaha8VV/tB5Ab7fSjmcRXw= Received: (qmail 964 invoked by alias); 28 Nov 2013 12:32:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 955 invoked by uid 89); 28 Nov 2013 12:32:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.2 required=5.0 tests=AWL, BAYES_40, RDNS_NONE, SPAM_BODY1, SPF_HELO_PASS, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Nov 2013 12:32:35 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rASCWSud022756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Nov 2013 07:32:28 -0500 Received: from redhat.com (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rASCWOvh002016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Thu, 28 Nov 2013 07:32:27 -0500 Date: Thu, 28 Nov 2013 13:32:24 +0100 From: Marek Polacek To: GCC Patches Subject: [PATCH, doc] Document -fsanitize=signed-integer-overflow Message-ID: <20131128123224.GH31608@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 * doc/invoke.texi: Document -fsanitize=signed-integer-overflow. Marek --- 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,