public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/31522]  New: [4.3 Regression] False overflow warning with division
@ 2007-04-10  7:28 pinskia at gcc dot gnu dot org
  2007-04-10  7:28 ` [Bug tree-optimization/31522] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-10  7:28 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-04-17 18:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-10  7:28 [Bug tree-optimization/31522] New: [4.3 Regression] False overflow warning with division pinskia at gcc dot gnu dot org
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

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).