[cfe-commits] [patch] Tracking simple arithmetic constraints (PR2695) (resubmitted)

Jordy Rose jediknil at belkadan.com
Sat Jun 5 23:15:09 PDT 2010


On Sun, 6 Jun 2010 13:52:30 +0800, Zhongxing Xu <xuzhongxing at gmail.com>
wrote:
> I understand your point. I mean we should also report such tautology
> conditions to the user in some checker and re-use that results in the
> following evaluation.
> 

Oh, okay. Well, it is using the overflow to determine feasibility (this
block, which does need to be better commented):

  if (TotalOverflow) {
    switch (SE->getOpcode()) {
    default:
      return state;
    case BinaryOperator::EQ:
      return Assumption ? NULL : state;
    case BinaryOperator::GE:
    case BinaryOperator::GT:
      return (Assumption ^ (TotalOverflow > 0)) ? state : NULL;
    case BinaryOperator::LE:
    case BinaryOperator::LT:
      return (Assumption ^ (TotalOverflow < 0)) ? state : NULL;
    }
  }


I'm a bit leery of warning since it could be a path-dependent tautology:

  if (length == 1)
    delta = -1;
  else
    delta = calculateDelta(length);

  if (length+delta > 0)
    doSomethingUsefulWith(length, delta);

Do you think it's worth warning in cases like this?

Jordy



More information about the cfe-commits mailing list