From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28717 invoked by alias); 24 Sep 2004 04:17:26 -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 28704 invoked from network); 24 Sep 2004 04:17:23 -0000 Received: from unknown (HELO ms-smtp-02.nyroc.rr.com) (24.24.2.56) by sourceware.org with SMTP; 24 Sep 2004 04:17:23 -0000 Received: from [192.168.0.49] (alb-24-195-142-251.nycap.rr.com [24.195.142.251]) by ms-smtp-02.nyroc.rr.com (8.12.10/8.12.10) with ESMTP id i8O4HKaX028968; Fri, 24 Sep 2004 00:17:20 -0400 (EDT) Message-ID: <41539FCC.3050503@nycap.rr.com> Date: Fri, 24 Sep 2004 06:31:00 -0000 From: Mathieu Malaterre User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040803 MIME-Version: 1.0 To: Giovanni Bajo CC: gcc@gcc.gnu.org Subject: Re: Warning flags for unsigned operations (unsafe) References: <4150C8D5.7070200@nycap.rr.com> <018901c4a1e6$d6a3b720$dc4e2a97@bagio> In-Reply-To: <018901c4a1e6$d6a3b720$dc4e2a97@bagio> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Symantec AntiVirus Scan Engine X-SW-Source: 2004-09/txt/msg01401.txt.bz2 Giovanni Bajo wrote: > Mathieu Malaterre wrote: > > >>I have been googling around and I couldn't find out if gcc had a >>warning flag for unsigned operation. For example, even the linear >>interpolation on [a,b] can be tricky to code: >> >>1. >>c = a + t * (b - a); //unsafe >> >>2. >>c = (1.0 - t) * a + t * b; //safe >> >>Number 1 will fail when both a and b are unsigned and let say b - a = >>-1 (math speaking). Is there something in gcc that could warn me for >>this kind of operation ? > > > Would you please file a bug report in Bugzilla and later mark it as a > enhancement request? Done: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17645 If I did something wrong just let me know, I'll correct it, Mathieu