This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/31522] [4.3 Regression] False overflow warning with division phi nodes



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-04-10 08:56 -------
IR after assert insertion (plus annotate with ranges found):
f (x)
{
  int y;
  int D.1599;

<bb 2>:
  if (x_2(D) <= 4) goto <L2>; else goto <L1>;

<L1>:;
  x_7 = ASSERT_EXPR <x_2(D), x_2(D) > 4>; // x_7: [5, +INF] 
  y_4 = x_7 / 4; // y_4: [1, 536870911]

  # y_1 = PHI <1(2), y_4(3)> // y_1: [1, +INF(OVF)]
<L2>:;
  D.1599_5 = y_1 <= 0;
  return D.1599_5;

}


Can someone explain how we go from the union of [1,1] and [1, 536870911]  to
get an inf with an overflow?

Here is another example but this time without a division and just plain obvious
no overflow as everything are just compares:
int f(int x)
{
  int y;
  if (x>536870911) y =1;
  else {
  if (x<0)  x = 1;
  y = x <=  0;
  }
  return y > 2;
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker
            Summary|[4.3 Regression] False      |[4.3 Regression] False
                   |overflow warning with       |overflow warning with
                   |division                    |division phi nodes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]