Program: 40715
Project: 40715
Buggy source:
/** 
 * Handle lines [14 - 19] of the algorithm, propagating information into and across a call site.
 */
protected void processCall(final PathEdge edge){
  if (DEBUG_LEVEL > 0) {
    System.err.println("String_Node_Str" + edge);
  }
  final int c=supergraph.getNumber(edge.n);
  final Collection<T> returnSites=Iterator2Collection.toCollection(supergraph.getReturnSites(edge.n));
  final Collection<T> returnSitesWithCallee=HashSetFactory.make();
  for (Iterator<? extends T> it=supergraph.getCalledNodes(edge.n); it.hasNext(); ) {
    final T callee=it.next();
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + callee);
    }
    IUnaryFlowFunction f=flowFunctionMap.getCallFlowFunction(edge.n,callee);
    SparseIntSet reached=computeFlow(edge.d2,f);
    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)) {
                  returnSitesWithCallee.add(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.n,exit,returnSite);
                    reachedBySummary.foreach(new IntSetAction(){
                      public void act(                      int d2){
                        if (retf instanceof IBinaryReturnFlowFunction) {
                          final SparseIntSet D5=computeBinaryFlow(edge.d2,d2,(IBinaryReturnFlowFunction)retf);
                          if (D5 != null) {
                            D5.foreach(new IntSetAction(){
                              public void act(                              int d5){
                                propagate(edge.s_p,edge.d1,returnSite,d5);
                              }
                            }
);
                          }
                        }
 else {
                          final SparseIntSet D5=computeFlow(d2,(IUnaryFlowFunction)retf);
                          if (D5 != null) {
                            D5.foreach(new IntSetAction(){
                              public void act(                              int d5){
                                propagate(edge.s_p,edge.d1,returnSite,d5);
                              }
                            }
);
                          }
                        }
                      }
                    }
);
                  }
                }
              }
            }
          }
        }
      }
);
    }
  }
  for (Iterator<? extends T> it=supergraph.getNormalSuccessors(edge.n); it.hasNext(); ) {
    final T m=it.next();
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + m);
    }
    IUnaryFlowFunction f=flowFunctionMap.getNormalFlowFunction(edge.n,m);
    SparseIntSet D3=computeFlow(edge.d2,f);
    if (D3 != null) {
      D3.foreach(new IntSetAction(){
        public void act(        int d3){
          propagate(edge.s_p,edge.d1,m,d3);
        }
      }
);
    }
  }
  for (  final T returnSite : returnSites) {
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + returnSite);
    }
    IUnaryFlowFunction f=null;
    if (returnSitesWithCallee.contains(returnSite)) {
      f=flowFunctionMap.getCallToReturnFlowFunction(edge.n,returnSite);
    }
 else {
      f=flowFunctionMap.getCallNoneToReturnFlowFunction(edge.n,returnSite);
    }
    SparseIntSet 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.s_p,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 edge){
  if (DEBUG_LEVEL > 0) {
    System.err.println("String_Node_Str" + edge);
  }
  final int c=supergraph.getNumber(edge.n);
  final Collection<T> returnSites=Iterator2Collection.toCollection(supergraph.getReturnSites(edge.n));
  for (Iterator<? extends T> it=supergraph.getCalledNodes(edge.n); it.hasNext(); ) {
    final T callee=it.next();
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + callee);
    }
    IUnaryFlowFunction f=flowFunctionMap.getCallFlowFunction(edge.n,callee);
    SparseIntSet reached=computeFlow(edge.d2,f);
    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.n,exit,returnSite);
                    reachedBySummary.foreach(new IntSetAction(){
                      public void act(                      int d2){
                        if (retf instanceof IBinaryReturnFlowFunction) {
                          final SparseIntSet D5=computeBinaryFlow(edge.d2,d2,(IBinaryReturnFlowFunction)retf);
                          if (D5 != null) {
                            D5.foreach(new IntSetAction(){
                              public void act(                              int d5){
                                propagate(edge.s_p,edge.d1,returnSite,d5);
                              }
                            }
);
                          }
                        }
 else {
                          final SparseIntSet D5=computeFlow(d2,(IUnaryFlowFunction)retf);
                          if (D5 != null) {
                            D5.foreach(new IntSetAction(){
                              public void act(                              int d5){
                                propagate(edge.s_p,edge.d1,returnSite,d5);
                              }
                            }
);
                          }
                        }
                      }
                    }
);
                  }
                }
              }
            }
          }
        }
      }
);
    }
  }
  for (Iterator<? extends T> it=supergraph.getNormalSuccessors(edge.n); it.hasNext(); ) {
    final T m=it.next();
    if (DEBUG_LEVEL > 0) {
      System.err.println("String_Node_Str" + m);
    }
    IUnaryFlowFunction f=flowFunctionMap.getNormalFlowFunction(edge.n,m);
    SparseIntSet D3=computeFlow(edge.d2,f);
    if (D3 != null) {
      D3.foreach(new IntSetAction(){
        public void act(        int d3){
          propagate(edge.s_p,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.n,returnSite);
    }
 else {
      f=flowFunctionMap.getCallNoneToReturnFlowFunction(edge.n,returnSite);
    }
    SparseIntSet 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.s_p,edge.d1,returnSite,x);
        }
      }
);
    }
  }
}