Program: 100061
Project: 100061
Buggy source:
/** 
 * Handle lines [14 - 19] of the algorithm, propagating information into and across a call site.
 */
protected void processCall(final PathEdge<T> edge){
  if (DEBUG_LEVEL > 0) {
    System.err.println("String_Node_Str" + edge);
  }
  final int c=supergraph.getNumber(edge.target);
  final Collection<T> returnSites=Iterator2Collection.toCollection(supergraph.getReturnSites(edge.target));
  for (Iterator<? extends T> it=supergraph.getCalledNodes(edge.target); it.hasNext(); ) {
    final T callee=it.next();
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + callee);
    }
    MutableSparseIntSet reached=MutableSparseIntSet.makeEmpty();
    for (    final T returnSite : returnSites) {
      IUnaryFlowFunction f=flowFunctionMap.getCallFlowFunction(edge.target,callee,returnSite);
      IntSet r=computeFlow(edge.d2,f);
      if (r != null) {
        reached.addAll(r);
      }
    }
    IUnaryFlowFunction f=flowFunctionMap.getCallFlowFunction(edge.target,callee,null);
    IntSet r=computeFlow(edge.d2,f);
    if (r != null) {
      reached.addAll(r);
    }
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + reached);
    }
    if (reached != null) {
      final LocalSummaryEdges summaries=summaryEdges.get(supergraph.getProcOf(callee));
      final CallFlowEdges callFlow=findOrCreateCallFlowEdges(callee);
      final int s_p_num=supergraph.getLocalBlockNumber(callee);
      reached.foreach(new IntSetAction(){
        public void act(        final int d1){
          propagate(callee,d1,callee,d1);
          callFlow.addCallEdge(c,edge.d2,d1);
          if (summaries != null) {
            P p=supergraph.getProcOf(callee);
            T[] exits=supergraph.getExitsForProcedure(p);
            for (int e=0; e < exits.length; e++) {
              T exit=exits[e];
              if (DEBUG_LEVEL > 0 && Assertions.verifyAssertions) {
                Assertions._assert(supergraph.containsNode(exit));
              }
              for (Iterator<? extends T> succ=supergraph.getSuccNodes(exit); succ.hasNext(); ) {
                final T returnSite=succ.next();
                if (returnSites.contains(returnSite)) {
                  int x_num=supergraph.getLocalBlockNumber(exit);
                  IntSet reachedBySummary=summaries.getSummaryEdges(s_p_num,x_num,d1);
                  if (reachedBySummary != null) {
                    final IFlowFunction retf=flowFunctionMap.getReturnFlowFunction(edge.target,exit,returnSite);
                    reachedBySummary.foreach(new IntSetAction(){
                      public void act(                      int d2){
                        if (retf instanceof IBinaryReturnFlowFunction) {
                          final IntSet D5=computeBinaryFlow(edge.d2,d2,(IBinaryReturnFlowFunction)retf);
                          if (D5 != null) {
                            D5.foreach(new IntSetAction(){
                              public void act(                              int d5){
                                propagate(edge.entry,edge.d1,returnSite,d5);
                              }
                            }
);
                          }
                        }
 else {
                          final IntSet D5=computeFlow(d2,(IUnaryFlowFunction)retf);
                          if (D5 != null) {
                            D5.foreach(new IntSetAction(){
                              public void act(                              int d5){
                                propagate(edge.entry,edge.d1,returnSite,d5);
                              }
                            }
);
                          }
                        }
                      }
                    }
);
                  }
                }
              }
            }
          }
        }
      }
);
    }
  }
  for (Iterator<? extends T> it=supergraph.getNormalSuccessors(edge.target); it.hasNext(); ) {
    final T m=it.next();
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + m);
    }
    IUnaryFlowFunction f=flowFunctionMap.getNormalFlowFunction(edge.target,m);
    IntSet D3=computeFlow(edge.d2,f);
    if (D3 != null) {
      D3.foreach(new IntSetAction(){
        public void act(        int d3){
          propagate(edge.entry,edge.d1,m,d3);
        }
      }
);
    }
  }
  for (  final T returnSite : returnSites) {
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + returnSite);
    }
    IUnaryFlowFunction f=null;
    if (hasCallee(returnSite)) {
      f=flowFunctionMap.getCallToReturnFlowFunction(edge.target,returnSite);
    }
 else {
      f=flowFunctionMap.getCallNoneToReturnFlowFunction(edge.target,returnSite);
    }
    IntSet reached=computeFlow(edge.d2,f);
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + reached);
    }
    if (reached != null) {
      reached.foreach(new IntSetAction(){
        public void act(        int x){
          if (Assertions.verifyAssertions) {
            Assertions._assert(x >= 0);
            Assertions._assert(edge.d1 >= 0);
          }
          propagate(edge.entry,edge.d1,returnSite,x);
        }
      }
);
    }
  }
}

Fixed version (ground truth):
/** 
 * Handle lines [14 - 19] of the algorithm, propagating information into and across a call site.
 */
protected void processCall(final PathEdge<T> edge){
  if (DEBUG_LEVEL > 0) {
    System.err.println("String_Node_Str" + edge);
  }
  final int c=supergraph.getNumber(edge.target);
  Collection<T> allReturnSites=HashSetFactory.make();
  allReturnSites.addAll(Iterator2Collection.toCollection(supergraph.getReturnSites(edge.target,null)));
  for (Iterator<? extends T> it=supergraph.getCalledNodes(edge.target); it.hasNext(); ) {
    final T callee=it.next();
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + callee);
    }
    MutableSparseIntSet reached=MutableSparseIntSet.makeEmpty();
    final Collection<T> returnSites=Iterator2Collection.toCollection(supergraph.getReturnSites(edge.target,supergraph.getProcOf(callee)));
    allReturnSites.addAll(returnSites);
    for (    final T returnSite : returnSites) {
      IUnaryFlowFunction f=flowFunctionMap.getCallFlowFunction(edge.target,callee,returnSite);
      IntSet r=computeFlow(edge.d2,f);
      if (r != null) {
        reached.addAll(r);
      }
    }
    IUnaryFlowFunction f=flowFunctionMap.getCallFlowFunction(edge.target,callee,null);
    IntSet r=computeFlow(edge.d2,f);
    if (r != null) {
      reached.addAll(r);
    }
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + reached);
    }
    if (reached != null) {
      final LocalSummaryEdges summaries=summaryEdges.get(supergraph.getProcOf(callee));
      final CallFlowEdges callFlow=findOrCreateCallFlowEdges(callee);
      final int s_p_num=supergraph.getLocalBlockNumber(callee);
      reached.foreach(new IntSetAction(){
        public void act(        final int d1){
          propagate(callee,d1,callee,d1);
          callFlow.addCallEdge(c,edge.d2,d1);
          if (summaries != null) {
            P p=supergraph.getProcOf(callee);
            T[] exits=supergraph.getExitsForProcedure(p);
            for (int e=0; e < exits.length; e++) {
              T exit=exits[e];
              if (DEBUG_LEVEL > 0 && Assertions.verifyAssertions) {
                Assertions._assert(supergraph.containsNode(exit));
              }
              for (Iterator<? extends T> succ=supergraph.getSuccNodes(exit); succ.hasNext(); ) {
                final T returnSite=succ.next();
                if (returnSites.contains(returnSite)) {
                  int x_num=supergraph.getLocalBlockNumber(exit);
                  IntSet reachedBySummary=summaries.getSummaryEdges(s_p_num,x_num,d1);
                  if (reachedBySummary != null) {
                    final IFlowFunction retf=flowFunctionMap.getReturnFlowFunction(edge.target,exit,returnSite);
                    reachedBySummary.foreach(new IntSetAction(){
                      public void act(                      int d2){
                        if (retf instanceof IBinaryReturnFlowFunction) {
                          final IntSet D5=computeBinaryFlow(edge.d2,d2,(IBinaryReturnFlowFunction)retf);
                          if (D5 != null) {
                            D5.foreach(new IntSetAction(){
                              public void act(                              int d5){
                                propagate(edge.entry,edge.d1,returnSite,d5);
                              }
                            }
);
                          }
                        }
 else {
                          final IntSet D5=computeFlow(d2,(IUnaryFlowFunction)retf);
                          if (D5 != null) {
                            D5.foreach(new IntSetAction(){
                              public void act(                              int d5){
                                propagate(edge.entry,edge.d1,returnSite,d5);
                              }
                            }
);
                          }
                        }
                      }
                    }
);
                  }
                }
              }
            }
          }
        }
      }
);
    }
  }
  for (Iterator<? extends T> it=supergraph.getNormalSuccessors(edge.target); it.hasNext(); ) {
    final T m=it.next();
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + m);
    }
    IUnaryFlowFunction f=flowFunctionMap.getNormalFlowFunction(edge.target,m);
    IntSet D3=computeFlow(edge.d2,f);
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + D3);
    }
    if (D3 != null) {
      D3.foreach(new IntSetAction(){
        public void act(        int d3){
          propagate(edge.entry,edge.d1,m,d3);
        }
      }
);
    }
  }
  for (  final T returnSite : allReturnSites) {
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + returnSite);
    }
    IUnaryFlowFunction f=null;
    if (hasCallee(returnSite)) {
      f=flowFunctionMap.getCallToReturnFlowFunction(edge.target,returnSite);
    }
 else {
      f=flowFunctionMap.getCallNoneToReturnFlowFunction(edge.target,returnSite);
    }
    IntSet reached=computeFlow(edge.d2,f);
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + reached);
    }
    if (reached != null) {
      reached.foreach(new IntSetAction(){
        public void act(        int x){
          if (Assertions.verifyAssertions) {
            Assertions._assert(x >= 0);
            Assertions._assert(edge.d1 >= 0);
          }
          propagate(edge.entry,edge.d1,returnSite,x);
        }
      }
);
    }
  }
}