public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mathieu Malaterre <mmalater@nycap.rr.com>
To: Giovanni Bajo <giovannibajo@libero.it>
Cc: gcc@gcc.gnu.org
Subject: Re: Warning flags for unsigned operations (unsafe)
Date: Fri, 24 Sep 2004 06:31:00 -0000	[thread overview]
Message-ID: <41539FCC.3050503@nycap.rr.com> (raw)
In-Reply-To: <018901c4a1e6$d6a3b720$dc4e2a97@bagio>

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

  reply	other threads:[~2004-09-24  4:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-22  5:33 Mathieu Malaterre
2004-09-22 10:00 ` sizeof(union) and #pragma pack() Dave Trollope, Diane Barrowman
2004-09-22 20:41   ` Geoffrey Keating
2004-09-22 14:57 ` Warning flags for unsigned operations (unsafe) Dave Korn
2004-09-22 15:12   ` Robert Dewar
2004-09-22 20:50   ` Luca Masini
2004-09-23  1:37     ` Mathieu Malaterre
2004-09-24  6:20 ` Giovanni Bajo
2004-09-24  6:31   ` Mathieu Malaterre [this message]
2004-09-22 15:38 Thomas R. Truscott
2004-09-22 16:18 ` Robert Dewar
2004-09-22 16:31 ` Robert Dewar
2004-09-22 16:53 ` Dave Korn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41539FCC.3050503@nycap.rr.com \
    --to=mmalater@nycap.rr.com \
    --cc=gcc@gcc.gnu.org \
    --cc=giovannibajo@libero.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).