[Bug tree-optimization/37508] [4.4 Regression] ICE in in simplify_truth_ops_using_ranges, at tree-vrp.c:6334

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Sep 13 14:08:00 GMT 2008



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-09-13 14:06 -------
Confirmed.

Also we fail to see that the return value cannot be zero in the following
cases:

struct foo1 {
  int i:1;
};
struct foo2 {
  unsigned i:1;
};

int test1 (struct foo1 *x)
{
  if (x->i == 0)
    return 1;
  else if (x->i == -1)
    return 1;
  return 0;
}

int test2 (struct foo2 *x)
{
  if (x->i == 0)
    return 1;
  else if (x->i == -1)
    return 1;
  return 0;
}

int test3 (struct foo1 *x)
{
  if (x->i == 0)
    return 1;
  else if (x->i == 1)
    return 1;
  return 0;
}

int test4 (struct foo2 *x)
{
  if (x->i == 0)
    return 1;
  else if (x->i == 1)
    return 1;
  return 0;
}

which is because we insert in the else-if

D.1237_5 = ASSERT_EXPR <D.1237_3, D.1237_3 != 0>;

from which we conclude D.1237_5: ~[0, 0] in the signed case.  In the
unsigned case the comparison is promoted to

 (int) x->i == -1

where the value range is also unhelpful, ~[0, 0] promoted to ~[0, 0].


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |tree-optimization
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code, missed-
                   |                            |optimization
   Last reconfirmed|0000-00-00 00:00:00         |2008-09-13 14:06:51
               date|                            |
            Summary|ICE in in                   |[4.4 Regression] ICE in in
                   |simplify_truth_ops_using_ran|simplify_truth_ops_using_ran
                   |ges, at tree-vrp.c:6334     |ges, at tree-vrp.c:6334
   Target Milestone|---                         |4.4.0


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



More information about the Gcc-bugs mailing list