public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/31522]  New: [4.3 Regression] False overflow warning with division
Date: Tue, 10 Apr 2007 07:28:00 -0000	[thread overview]
Message-ID: <bug-31522-6528@http.gcc.gnu.org/bugzilla/> (raw)

Compile this with -O2 -W -Wall and you should not get a warning but you get an
overflow warning which is a false positive as this condition can never be false
even with overflow (as shown by doing -Dint=unsigned):
int bar(int);

int f(int x)
{
  int y;
  if (x<=4)  y = 1;
  else y = x/4;
  return y <=  0;
}

---------------- CUT -------------------
t.c: In function 'f':
t.c:8: warning: assuming signed overflow does not occur when simplifying
conditional to constant

How can x/4 cause an overflow when x>4 and never negative?

Also when I do -Dint=unsigned or even -fwrapv, VRP still is able to say y is
always greater than 0.


-- 
           Summary: [4.3 Regression] False overflow warning with division
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31522


             reply	other threads:[~2007-04-10  7:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-10  7:28 pinskia at gcc dot gnu dot org [this message]
2007-04-10  7:28 ` [Bug tree-optimization/31522] " pinskia at gcc dot gnu dot org
2007-04-10  7:30 ` pinskia at gcc dot gnu dot org
2007-04-10  7:57 ` [Bug tree-optimization/31522] [4.3 Regression] False overflow warning with division phi nodes pinskia at gcc dot gnu dot org
2007-04-10 12:39 ` [Bug tree-optimization/31522] [4.3 Regression] False overflow warning with " rguenth at gcc dot gnu dot org
2007-04-11  5:34 ` [Bug tree-optimization/31522] " pinskia at gcc dot gnu dot org
2007-04-11  6:15 ` ian at airs dot com
2007-04-11  6:38 ` pinskia at gcc dot gnu dot org
2007-04-11  7:04 ` ian at airs dot com
2007-04-11  8:14 ` rguenth at gcc dot gnu dot org
2007-04-17  5:33 ` ian at gcc dot gnu dot org
2007-04-17 18:09 ` ian at airs dot com

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=bug-31522-6528@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).