Program: 6313
Project: 6313
Buggy source:
private void doIfIcmp(InstructionHandle stmt,FlowEdge edge,Context context,Map<Location,ValueMapping> in,Map<Location,ValueMapping> result){
  Interval constraint=null;
  for (Iterator<Location> i=in.keySet().iterator(); i.hasNext(); ) {
    Location l=i.next();
    if (l.stackLoc == context.stackPtr - 1) {
      constraint=in.get(l).assigned;
    }
  }
  for (Iterator<Location> i=in.keySet().iterator(); i.hasNext(); ) {
    Location l=i.next();
    if (l.stackLoc < context.stackPtr - 2) {
      result.put(l,in.get(l));
    }
  }
  for (Iterator<Location> i=in.keySet().iterator(); i.hasNext(); ) {
    Location l=i.next();
    if (l.stackLoc == context.stackPtr - 2 && in.get(l).source != null) {
      ValueMapping m=new ValueMapping(in.get(l),true);
switch (stmt.getInstruction().getOpcode()) {
case Constants.IF_ICMPEQ:
        if (edge.getType() == FlowEdge.FALSE_EDGE) {
        }
 else         if (edge.getType() == FlowEdge.TRUE_EDGE) {
          if (constraint.hasLb()) {
            m.constrained.setLb(constraint.getLb());
          }
          if (constraint.hasUb()) {
            m.constrained.setUb(constraint.getUb());
          }
        }
      break;
case Constants.IF_ICMPNE:
    if (edge.getType() == FlowEdge.FALSE_EDGE) {
      if (constraint.hasLb()) {
        m.constrained.setLb(constraint.getLb());
      }
      if (constraint.hasUb()) {
        m.constrained.setUb(constraint.getUb());
      }
    }
 else     if (edge.getType() == FlowEdge.TRUE_EDGE) {
    }
  break;
case Constants.IF_ICMPLT:
if (edge.getType() == FlowEdge.FALSE_EDGE) {
  if (constraint.hasLb()) {
    m.constrained.setLb(constraint.getLb());
  }
}
 else if (edge.getType() == FlowEdge.TRUE_EDGE) {
  if (constraint.hasUb()) {
    m.constrained.setUb(constraint.getUb() - 1);
  }
}
break;
case Constants.IF_ICMPGE:
if (edge.getType() == FlowEdge.FALSE_EDGE) {
if (constraint.hasUb()) {
m.constrained.setUb(constraint.getUb() - 1);
}
}
 else if (edge.getType() == FlowEdge.TRUE_EDGE) {
if (constraint.hasLb()) {
m.constrained.setLb(constraint.getLb());
}
}
break;
case Constants.IF_ICMPGT:
if (edge.getType() == FlowEdge.FALSE_EDGE) {
if (constraint.hasUb()) {
m.constrained.setUb(constraint.getUb());
}
}
 else if (edge.getType() == FlowEdge.TRUE_EDGE) {
if (constraint.hasLb()) {
m.constrained.setLb(constraint.getLb() + 1);
}
}
break;
case Constants.IF_ICMPLE:
if (edge.getType() == FlowEdge.FALSE_EDGE) {
if (constraint.hasLb()) {
m.constrained.setLb(constraint.getLb() - 1);
}
}
 else if (edge.getType() == FlowEdge.TRUE_EDGE) {
if (constraint.hasUb()) {
m.constrained.setUb(constraint.getUb());
}
}
break;
}
if (m.assigned.getLb() > m.constrained.getUb() || m.assigned.getUb() < m.constrained.getLb()) {
}
m.assigned.constrain(m.constrained);
recordBound(stmt,context,edge,m);
result.put(in.get(l).source,m);
}
}
}

Fixed version (ground truth):
private void doIfIcmp(InstructionHandle stmt,FlowEdge edge,Context context,Map<Location,ValueMapping> in,Map<Location,ValueMapping> result){
  Interval constraint=null;
  for (Iterator<Location> i=in.keySet().iterator(); i.hasNext(); ) {
    Location l=i.next();
    if (l.stackLoc == context.stackPtr - 1) {
      constraint=in.get(l).assigned;
    }
  }
  for (Iterator<Location> i=in.keySet().iterator(); i.hasNext(); ) {
    Location l=i.next();
    if (l.stackLoc < context.stackPtr - 2) {
      result.put(l,in.get(l));
    }
  }
  for (Iterator<Location> i=in.keySet().iterator(); i.hasNext(); ) {
    Location l=i.next();
    if (l.stackLoc == context.stackPtr - 2 && in.get(l).source != null) {
      ValueMapping m=new ValueMapping(in.get(l),true);
switch (stmt.getInstruction().getOpcode()) {
case Constants.IF_ICMPEQ:
        if (edge.getType() == FlowEdge.FALSE_EDGE) {
        }
 else         if (edge.getType() == FlowEdge.TRUE_EDGE) {
          if (constraint.hasLb()) {
            m.constrained.setLb(constraint.getLb());
          }
          if (constraint.hasUb()) {
            m.constrained.setUb(constraint.getUb());
          }
        }
      break;
case Constants.IF_ICMPNE:
    if (edge.getType() == FlowEdge.FALSE_EDGE) {
      if (constraint.hasLb()) {
        m.constrained.setLb(constraint.getLb());
      }
      if (constraint.hasUb()) {
        m.constrained.setUb(constraint.getUb());
      }
    }
 else     if (edge.getType() == FlowEdge.TRUE_EDGE) {
    }
  break;
case Constants.IF_ICMPLT:
if (edge.getType() == FlowEdge.FALSE_EDGE) {
  if (constraint.hasLb()) {
    m.constrained.setLb(constraint.getLb());
  }
}
 else if (edge.getType() == FlowEdge.TRUE_EDGE) {
  if (constraint.hasUb()) {
    m.constrained.setUb(constraint.getUb() - 1);
  }
}
break;
case Constants.IF_ICMPGE:
if (edge.getType() == FlowEdge.FALSE_EDGE) {
if (constraint.hasUb()) {
m.constrained.setUb(constraint.getUb() - 1);
}
}
 else if (edge.getType() == FlowEdge.TRUE_EDGE) {
if (constraint.hasLb()) {
m.constrained.setLb(constraint.getLb());
}
}
break;
case Constants.IF_ICMPGT:
if (edge.getType() == FlowEdge.FALSE_EDGE) {
if (constraint.hasUb()) {
m.constrained.setUb(constraint.getUb());
}
}
 else if (edge.getType() == FlowEdge.TRUE_EDGE) {
if (constraint.hasLb()) {
m.constrained.setLb(constraint.getLb() + 1);
}
}
break;
case Constants.IF_ICMPLE:
if (edge.getType() == FlowEdge.FALSE_EDGE) {
if (constraint.hasLb()) {
m.constrained.setLb(constraint.getLb() - 1);
}
}
 else if (edge.getType() == FlowEdge.TRUE_EDGE) {
if (constraint.hasUb()) {
m.constrained.setUb(constraint.getUb());
}
}
break;
}
if (m.assigned.getLb() > m.constrained.getUb() || m.assigned.getUb() < m.constrained.getLb()) {
}
m.assigned.constrain(m.constrained);
recordBound(stmt,context,edge,new ValueMapping(m,true));
m.softinc=true;
result.put(in.get(l).source,m);
}
}
}