From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10329 invoked by alias); 14 Jul 2005 18:36:24 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 10320 invoked by uid 22791); 14 Jul 2005 18:36:19 -0000 Received: from sadr.equallogic.com (HELO sadr.equallogic.com) (66.155.203.134) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 14 Jul 2005 18:36:19 +0000 Received: from sadr.equallogic.com (localhost.localdomain [127.0.0.1]) by sadr.equallogic.com (8.12.8/8.12.8) with ESMTP id j6EIaHZb024745 for ; Thu, 14 Jul 2005 14:36:18 -0400 Received: from M31.equallogic.com (M31.equallogic.com [172.16.1.31]) by sadr.equallogic.com (8.12.8/8.12.8) with SMTP id j6EIaHNd024740; Thu, 14 Jul 2005 14:36:17 -0400 Received: from PKONING.equallogic.com ([172.16.18.11]) by M31.equallogic.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 14 Jul 2005 14:36:17 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17110.45219.484000.417340@gargle.gargle.HOWL> Date: Thu, 14 Jul 2005 18:36:00 -0000 From: Paul Koning To: mattheww@chiark.greenend.org.uk Cc: gcc@gcc.gnu.org Subject: Re: Where does the C standard describe overflow of signed integers? References: <20050714175713.GA16889@chiark.greenend.org.uk> X-SW-Source: 2005-07/txt/msg00607.txt.bz2 >>>>> "Matthew" == Matthew Woodcraft writes: Matthew> Paul Schlie wrote: >> As optimization seems to be a non-argument, as by analogy all >> optimizations which are available for unsigned arithmetic are >> correspondingly available for signed integer operations; as any >> signed value may then be thought of as being unsigned for the >> purposes of computation and/or comparison. Matthew> What about optimising x*2/2 to x? If that doesn't overflow then it's valid, and if overflow is undefined it's valid in that case, too. :-) Of course this would be an example where overflow isn't treated as 2s complement wrap... paul