Program: 12025
Project: 12025
Buggy source:
public PDGSlice(PDG pdg,BasicBlock boundaryBlock,PDGNode nodeCriterion,AbstractVariable localVariableCriterion){
  this(pdg,boundaryBlock);
  this.nodeCriterion=nodeCriterion;
  this.localVariableCriterion=localVariableCriterion;
  this.sliceNodes=new TreeSet<PDGNode>();
  sliceNodes.addAll(computeSlice(nodeCriterion,localVariableCriterion));
  this.remainingNodes=new TreeSet<PDGNode>();
  remainingNodes.add(pdg.getEntryNode());
  for (  GraphNode node : pdg.nodes) {
    PDGNode pdgNode=(PDGNode)node;
    if (!sliceNodes.contains(pdgNode))     remainingNodes.add(pdgNode);
  }
  this.passedParameters=new LinkedHashSet<AbstractVariable>();
  Set<PDGNode> nCD=new LinkedHashSet<PDGNode>();
  Set<PDGNode> nDD=new LinkedHashSet<PDGNode>();
  for (  GraphEdge edge : pdg.edges) {
    PDGDependence dependence=(PDGDependence)edge;
    PDGNode srcPDGNode=(PDGNode)dependence.src;
    PDGNode dstPDGNode=(PDGNode)dependence.dst;
    if (dependence instanceof PDGDataDependence) {
      PDGDataDependence dataDependence=(PDGDataDependence)dependence;
      if (remainingNodes.contains(srcPDGNode) && sliceNodes.contains(dstPDGNode))       passedParameters.add(dataDependence.getData());
      if (sliceNodes.contains(srcPDGNode) && remainingNodes.contains(dstPDGNode) && !dataDependence.getData().equals(localVariableCriterion))       nDD.add(srcPDGNode);
    }
 else     if (dependence instanceof PDGControlDependence) {
      if (sliceNodes.contains(srcPDGNode) && remainingNodes.contains(dstPDGNode))       nCD.add(srcPDGNode);
    }
  }
  Set<PDGNode> controlIndispensableNodes=new LinkedHashSet<PDGNode>();
  for (  PDGNode p : nCD) {
    for (    AbstractVariable usedVariable : p.usedVariables) {
      Set<PDGNode> pSliceNodes=computeSlice(p,usedVariable);
      for (      GraphNode node : pdg.nodes) {
        PDGNode q=(PDGNode)node;
        if (pSliceNodes.contains(q) || q.equals(p))         controlIndispensableNodes.add(q);
      }
    }
  }
  Set<PDGNode> dataIndispensableNodes=new LinkedHashSet<PDGNode>();
  for (  PDGNode p : nDD) {
    for (    AbstractVariable definedVariable : p.definedVariables) {
      Set<PDGNode> pSliceNodes=computeSlice(p,definedVariable);
      for (      GraphNode node : pdg.nodes) {
        PDGNode q=(PDGNode)node;
        if (pSliceNodes.contains(q))         dataIndispensableNodes.add(q);
      }
    }
  }
  this.indispensableNodes=new TreeSet<PDGNode>();
  indispensableNodes.addAll(controlIndispensableNodes);
  indispensableNodes.addAll(dataIndispensableNodes);
  this.removableNodes=new LinkedHashSet<PDGNode>();
  for (  GraphNode node : pdg.nodes) {
    PDGNode pdgNode=(PDGNode)node;
    if (!remainingNodes.contains(pdgNode) && !indispensableNodes.contains(pdgNode))     removableNodes.add(pdgNode);
  }
}

Fixed version (ground truth):
public PDGSlice(PDG pdg,BasicBlock boundaryBlock,PDGNode nodeCriterion,AbstractVariable localVariableCriterion){
  this(pdg,boundaryBlock);
  this.nodeCriterion=nodeCriterion;
  this.localVariableCriterion=localVariableCriterion;
  this.sliceNodes=new TreeSet<PDGNode>();
  sliceNodes.addAll(computeSlice(nodeCriterion,localVariableCriterion));
  this.remainingNodes=new TreeSet<PDGNode>();
  remainingNodes.add(pdg.getEntryNode());
  for (  GraphNode node : pdg.nodes) {
    PDGNode pdgNode=(PDGNode)node;
    if (!sliceNodes.contains(pdgNode))     remainingNodes.add(pdgNode);
  }
  this.passedParameters=new LinkedHashSet<AbstractVariable>();
  Set<PDGNode> nCD=new LinkedHashSet<PDGNode>();
  Set<PDGNode> nDD=new LinkedHashSet<PDGNode>();
  for (  GraphEdge edge : pdg.edges) {
    PDGDependence dependence=(PDGDependence)edge;
    PDGNode srcPDGNode=(PDGNode)dependence.src;
    PDGNode dstPDGNode=(PDGNode)dependence.dst;
    if (dependence instanceof PDGDataDependence) {
      PDGDataDependence dataDependence=(PDGDataDependence)dependence;
      if (remainingNodes.contains(srcPDGNode) && sliceNodes.contains(dstPDGNode))       passedParameters.add(dataDependence.getData());
      if (sliceNodes.contains(srcPDGNode) && remainingNodes.contains(dstPDGNode) && !dataDependence.getData().equals(localVariableCriterion)&& !dataDependence.getData().isField())       nDD.add(srcPDGNode);
    }
 else     if (dependence instanceof PDGControlDependence) {
      if (sliceNodes.contains(srcPDGNode) && remainingNodes.contains(dstPDGNode))       nCD.add(srcPDGNode);
    }
  }
  Set<PDGNode> controlIndispensableNodes=new LinkedHashSet<PDGNode>();
  for (  PDGNode p : nCD) {
    for (    AbstractVariable usedVariable : p.usedVariables) {
      Set<PDGNode> pSliceNodes=computeSlice(p,usedVariable);
      for (      GraphNode node : pdg.nodes) {
        PDGNode q=(PDGNode)node;
        if (pSliceNodes.contains(q) || q.equals(p))         controlIndispensableNodes.add(q);
      }
    }
  }
  Set<PDGNode> dataIndispensableNodes=new LinkedHashSet<PDGNode>();
  for (  PDGNode p : nDD) {
    for (    AbstractVariable definedVariable : p.definedVariables) {
      Set<PDGNode> pSliceNodes=computeSlice(p,definedVariable);
      for (      GraphNode node : pdg.nodes) {
        PDGNode q=(PDGNode)node;
        if (pSliceNodes.contains(q))         dataIndispensableNodes.add(q);
      }
    }
  }
  this.indispensableNodes=new TreeSet<PDGNode>();
  indispensableNodes.addAll(controlIndispensableNodes);
  indispensableNodes.addAll(dataIndispensableNodes);
  this.removableNodes=new LinkedHashSet<PDGNode>();
  for (  GraphNode node : pdg.nodes) {
    PDGNode pdgNode=(PDGNode)node;
    if (!remainingNodes.contains(pdgNode) && !indispensableNodes.contains(pdgNode))     removableNodes.add(pdgNode);
  }
}