+      /* An anti-range implies the original variable is signed and
+         its lower bound is negative and the upper bound positive.
+         Since that means that the expression's value could be zero
+         nothing interesting can be inferred from this.  */
I'm not sure I agree with this comment.  For example, we often get an
anti-range like ~[0,0].

I don't mind punting anti-ranges, but I think the comments needs
updating unless there's something else in this code that ensures that an
anti range reaching this point fits the property above.

I'm not sure it's 100% correct either so I replaced the comment
with a FIXME as reminder to revisit it.  It is what I saw while
debugging this code.  For example, in this:

  char d[3];

  void f (int n)
  {
    if (n < -7 || 4 < n)
      n = -7;

    __builtin_memset (d, 0, n);
  }

VRP reports this:

  n_4: [-7, 4]  EQUIVALENCES: { n_5(D) } (1 elements)
  ...
  prephitmp_9: ~[5, 18446744073709551608]
  ...
  # prephitmp_9 = PHI <_8(3), 18446744073709551609(2)>
  __builtin_memset (&d, 0, prephitmp_9);


With the comment fixes noted above, this is OK.

Thanks.  I've made the changes above.  While retesting the patch
I noticed a couple of Fortran test failures that I must have missed
the first time around.  I fixed those and wound up committing r243419.

Martin

Reply via email to