Program: 132770
Project: 132770
Buggy source:
/** 
 * Add any inverse operations that can be directly inferred from a value that was just added
 * @param errContext
 * @param canonLoc
 * @param canonVal
 * @throws OptUnsafeError 
 */
private void addInverses(GlobalConstants consts,String errContext,Arg canonLoc,ArgOrCV canonVal,int stmtIndex) throws OptUnsafeError {
  if (canonVal.isCV() && canonVal.cv().inputs.size() == 1) {
    ComputedValue<Arg> cv=canonVal.cv();
    Arg invOutput=cv.getInput(0);
    if (cv.op().isAssign(false)) {
      ArgCV invVal=ComputedValue.assignCompVal(invOutput.getVar(),false);
      updateInv(consts,errContext,invOutput,invVal,stmtIndex);
    }
 else     if (cv.op().isRecursiveAssign()) {
      ArgCV invVal=ComputedValue.retrieveCompVal(canonLoc.getVar(),true);
      updateInv(consts,errContext,invOutput,invVal,stmtIndex);
    }
 else     if (cv.op().isRetrieve(false)) {
      ArgCV invVal=ComputedValue.assignCompVal(invOutput.getVar(),false);
      updateInv(consts,errContext,invOutput,invVal,stmtIndex);
    }
 else     if (cv.op().isRecursiveRetrieve()) {
      Opcode invOp=Opcode.assignOpcode(invOutput.getVar(),true);
      assert(invOp != null);
      ArgCV invVal=new ArgCV(invOp,canonLoc.asList());
      updateInv(consts,errContext,invOutput,invVal,stmtIndex);
    }
  }
 else   if (canonVal.isArg() && canonVal.arg().isVar() && canonVal.arg().getVar().storage() == Alloc.GLOBAL_CONST) {
    Var globalConst=canonVal.arg().getVar();
    Arg constVal=consts.lookupByVar(globalConst);
    assert(constVal != null);
    ArgCV invVal=ComputedValue.retrieveCompVal(globalConst,false);
    updateInv(consts,errContext,constVal,invVal,stmtIndex);
  }
}

Fixed version (ground truth):
/** 
 * Add any inverse operations that can be directly inferred from a value that was just added
 * @param errContext
 * @param canonLoc
 * @param canonVal
 * @throws OptUnsafeError 
 */
private void addInverses(GlobalConstants consts,String errContext,Arg canonLoc,ArgOrCV canonVal,int stmtIndex) throws OptUnsafeError {
  if (canonVal.isCV() && canonVal.cv().inputs.size() == 1) {
    ComputedValue<Arg> cv=canonVal.cv();
    Arg invOutput=cv.getInput(0);
    if (cv.op().isAssign(false)) {
      ArgCV invVal=ComputedValue.retrieveCompVal(canonLoc.getVar(),false);
      updateInv(consts,errContext,invOutput,invVal,stmtIndex);
    }
 else     if (cv.op().isRecursiveAssign()) {
      ArgCV invVal=ComputedValue.retrieveCompVal(canonLoc.getVar(),true);
      updateInv(consts,errContext,invOutput,invVal,stmtIndex);
    }
 else     if (cv.op().isRetrieve(false)) {
      ArgCV invVal=ComputedValue.assignCompVal(invOutput.getVar(),false);
      updateInv(consts,errContext,invOutput,invVal,stmtIndex);
    }
 else     if (cv.op().isRecursiveRetrieve()) {
      ArgCV invVal=ComputedValue.assignCompVal(invOutput.getVar(),true);
      updateInv(consts,errContext,invOutput,invVal,stmtIndex);
      updateInv(consts,errContext,invOutput,invVal,stmtIndex);
    }
  }
 else   if (canonVal.isArg() && canonVal.arg().isVar() && canonVal.arg().getVar().storage() == Alloc.GLOBAL_CONST) {
    Var globalConst=canonVal.arg().getVar();
    Arg constVal=consts.lookupByVar(globalConst);
    assert(constVal != null);
    ArgCV invVal=ComputedValue.retrieveCompVal(globalConst,false);
    updateInv(consts,errContext,constVal,invVal,stmtIndex);
  }
}