Program: 27924
Project: 27924
Buggy source:
/** 
 * Removes any vars in the scope that were not referenced. Removes any assignments to those variables as well.
 */
private void removeUnreferencedVars(){
  for (Iterator<Var> it=maybeUnreferenced.iterator(); it.hasNext(); ) {
    Var var=it.next();
    for (    Node exprCallNode : classDefiningCalls.get(var)) {
      NodeUtil.removeChild(exprCallNode.getParent(),exprCallNode);
      compiler.reportCodeChange();
    }
    removeAllAssigns(var);
    compiler.addToDebugLog("String_Node_Str" + var.name);
    Node nameNode=var.nameNode;
    Node toRemove=nameNode.getParent();
    Node parent=toRemove.getParent();
    Preconditions.checkState(toRemove.isVar() || toRemove.isFunction() || toRemove.isParamList() && parent.isFunction(),"String_Node_Str");
    if (toRemove.isParamList() && parent.isFunction()) {
    }
 else     if (NodeUtil.isFunctionExpression(toRemove)) {
      if (!preserveFunctionExpressionNames) {
        toRemove.getFirstChild().setString("String_Node_Str");
        compiler.reportCodeChange();
      }
    }
 else     if (parent != null && parent.isFor() && parent.getChildCount() < 4) {
    }
 else     if (toRemove.isVar() && nameNode.hasChildren() && NodeUtil.mayHaveSideEffects(nameNode.getFirstChild(),compiler)) {
      if (toRemove.getChildCount() == 1) {
        parent.replaceChild(toRemove,IR.exprResult(nameNode.removeFirstChild()));
        compiler.reportCodeChange();
      }
    }
 else     if (toRemove.isVar() && toRemove.getChildCount() > 1) {
      toRemove.removeChild(nameNode);
      compiler.reportCodeChange();
    }
 else     if (parent != null) {
      NodeUtil.removeChild(parent,toRemove);
      compiler.reportCodeChange();
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes any vars in the scope that were not referenced. Removes any assignments to those variables as well.
 */
private void removeUnreferencedVars(){
  for (Iterator<Var> it=maybeUnreferenced.iterator(); it.hasNext(); ) {
    Var var=it.next();
    for (    Node exprCallNode : classDefiningCalls.get(var)) {
      compiler.reportChangeToEnclosingScope(exprCallNode);
      NodeUtil.removeChild(exprCallNode.getParent(),exprCallNode);
    }
    removeAllAssigns(var);
    compiler.addToDebugLog("String_Node_Str" + var.name);
    Node nameNode=var.nameNode;
    Node toRemove=nameNode.getParent();
    Node parent=toRemove.getParent();
    Preconditions.checkState(toRemove.isVar() || toRemove.isFunction() || toRemove.isParamList() && parent.isFunction(),"String_Node_Str");
    if (toRemove.isParamList() && parent.isFunction()) {
    }
 else     if (NodeUtil.isFunctionExpression(toRemove)) {
      if (!preserveFunctionExpressionNames) {
        compiler.reportChangeToEnclosingScope(toRemove);
        toRemove.getFirstChild().setString("String_Node_Str");
      }
    }
 else     if (parent != null && parent.isFor() && parent.getChildCount() < 4) {
    }
 else     if (toRemove.isVar() && nameNode.hasChildren() && NodeUtil.mayHaveSideEffects(nameNode.getFirstChild(),compiler)) {
      if (toRemove.getChildCount() == 1) {
        compiler.reportChangeToEnclosingScope(toRemove);
        parent.replaceChild(toRemove,IR.exprResult(nameNode.removeFirstChild()));
      }
    }
 else     if (toRemove.isVar() && toRemove.getChildCount() > 1) {
      compiler.reportChangeToEnclosingScope(toRemove);
      toRemove.removeChild(nameNode);
    }
 else     if (parent != null) {
      compiler.reportChangeToEnclosingScope(toRemove);
      NodeUtil.removeChild(parent,toRemove);
    }
  }
}