From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5310 invoked by alias); 26 Sep 2013 18:19:50 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 5209 invoked by uid 89); 26 Sep 2013 18:19:49 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Sep 2013 18:19:49 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_20,RP_MATCHES_RCVD,SPAM_SUBJECT autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8QIJkD1028934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Sep 2013 14:19:46 -0400 Received: from zebedee.pink (ovpn-113-58.phx2.redhat.com [10.3.113.58]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8QHUAh8002253; Thu, 26 Sep 2013 13:30:11 -0400 Message-ID: <52446F22.3040205@redhat.com> Date: Thu, 26 Sep 2013 18:19:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Re: how to make gcc warn about arithmetic signed overflow References: <20130921174229.GD3086@a.lan> <20130923000355.fa2a964c.jklowden@schemamania.org> <52409B07.1070002@redhat.com> <20130923180022.b06c9ae2.jklowden@schemamania.org> <5241D058.6000209@redhat.com> <20130925222958.63f91bc9.jklowden@schemamania.org> <20130926082941.GA31230@ypig.lip.ens-lyon.fr> <52444961.6030103@redhat.com> <20130926170232.GA8435@xvii.vinc17.org> In-Reply-To: <20130926170232.GA8435@xvii.vinc17.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00189.txt.bz2 On 09/26/2013 06:02 PM, Vincent Lefevre wrote: > On 2013-09-26 15:49:05 +0100, Andrew Haley wrote: >> On 09/26/2013 09:29 AM, Vincent Lefevre wrote: >>> On 2013-09-25 22:29:58 -0400, James K. Lowden wrote: >>>> You mean that a naïve rendering of the source code implies an overflow >>>> where none might exist in the actual emitted object code. And, >>>> presumably, the converse: that even if the source is written such that >>>> there logically can't be an overflow, the compiler might render object >>>> code that does. >>> >>> The converse is forbidden. >> >> You'll find it hard to justify that by any language in the standard. > > What do you mean? There is no reason why a compiler should not generate an overflow where none is written in the program, as long as it doesn't generate a different result. Andrew.