Program: 41045
Project: 41045
Buggy source:
public Iterator<? extends Statement> getPredNodes(Statement N){
  if (Assertions.verifyAssertions && dOptions.isIgnoreExceptions()) {
    Assertions._assert(!N.getKind().equals(Kind.EXC_RET_CALLEE));
    Assertions._assert(!N.getKind().equals(Kind.EXC_RET_CALLER));
  }
switch (N.getKind()) {
case NORMAL:
case PHI:
case PI:
case EXC_RET_CALLEE:
case NORMAL_RET_CALLEE:
case PARAM_CALLER:
case HEAP_PARAM_CALLER:
case HEAP_RET_CALLEE:
case CATCH:
    return getPDG(N.getNode()).getPredNodes(N);
case EXC_RET_CALLER:
{
    ParamStatement.ExceptionalReturnCaller nrc=(ParamStatement.ExceptionalReturnCaller)N;
    SSAInvokeInstruction call=nrc.getCall();
    Collection<Statement> result=HashSetFactory.make(5);
    if (!dOptions.equals(DataDependenceOptions.NONE)) {
      for (      CGNode t : N.getNode().getPossibleTargets(call.getCallSite())) {
        Statement s=new ParamStatement.ExceptionalReturnCallee(t);
        addNode(s);
        result.add(s);
      }
    }
    return result.iterator();
  }
case NORMAL_RET_CALLER:
{
  ParamStatement.NormalReturnCaller nrc=(ParamStatement.NormalReturnCaller)N;
  SSAInvokeInstruction call=nrc.getCall();
  Collection<Statement> result=HashSetFactory.make(5);
  if (!dOptions.equals(DataDependenceOptions.NONE)) {
    for (    CGNode t : N.getNode().getPossibleTargets(call.getCallSite())) {
      Statement s=new ParamStatement.NormalReturnCallee(t);
      addNode(s);
      result.add(s);
    }
  }
  return result.iterator();
}
case HEAP_RET_CALLER:
{
HeapStatement.ReturnCaller r=(HeapStatement.ReturnCaller)N;
SSAInvokeInstruction call=r.getCall();
Collection<Statement> result=new Iterator2Collection<Statement>(getPDG(N.getNode()).getPredNodes(N));
if (!dOptions.equals(DataDependenceOptions.NONE)) {
  for (  CGNode t : N.getNode().getPossibleTargets(call.getCallSite())) {
    if (mod.get(t).contains(r.getLocation())) {
      Statement s=new HeapStatement.ReturnCallee(t,r.getLocation());
      addNode(s);
      result.add(s);
    }
  }
}
return result.iterator();
}
case PARAM_CALLEE:
{
ParamStatement.ParamCallee pac=(ParamStatement.ParamCallee)N;
int parameterIndex=pac.getValueNumber() - 1;
Collection<Statement> result=HashSetFactory.make(5);
if (!dOptions.equals(DataDependenceOptions.NONE)) {
for (Iterator<? extends CGNode> it=cg.getPredNodes(N.getNode()); it.hasNext(); ) {
  CGNode caller=it.next();
  for (Iterator<CallSiteReference> it2=caller.getPossibleSites(N.getNode()); it2.hasNext(); ) {
    CallSiteReference site=it2.next();
    IR ir=caller.getIR(new WarningSet());
    IntSet indices=ir.getCallInstructionIndices(site);
    for (IntIterator ii=indices.intIterator(); ii.hasNext(); ) {
      int i=ii.next();
      SSAInvokeInstruction call=(SSAInvokeInstruction)ir.getInstructions()[i];
      int p=call.getUse(parameterIndex);
      Statement s=new ParamStatement.ParamCaller(caller,call,p);
      addNode(s);
      result.add(s);
    }
  }
}
}
if (!cOptions.equals(ControlDependenceOptions.NONE)) {
Statement s=new MethodEntryStatement(N.getNode());
addNode(s);
result.add(s);
}
return result.iterator();
}
case HEAP_PARAM_CALLEE:
{
HeapStatement.ParamCallee hpc=(HeapStatement.ParamCallee)N;
Collection<Statement> result=HashSetFactory.make(5);
if (!dOptions.equals(DataDependenceOptions.NONE)) {
for (Iterator<? extends CGNode> it=cg.getPredNodes(N.getNode()); it.hasNext(); ) {
CGNode caller=it.next();
for (Iterator<CallSiteReference> it2=caller.getPossibleSites(N.getNode()); it2.hasNext(); ) {
  CallSiteReference site=it2.next();
  IR ir=caller.getIR(new WarningSet());
  IntSet indices=ir.getCallInstructionIndices(site);
  for (IntIterator ii=indices.intIterator(); ii.hasNext(); ) {
    int i=ii.next();
    SSAInvokeInstruction call=(SSAInvokeInstruction)ir.getInstructions()[i];
    Statement s=new HeapStatement.ParamCaller(caller,call,hpc.getLocation());
    addNode(s);
    result.add(s);
  }
}
}
}
if (!cOptions.equals(ControlDependenceOptions.NONE)) {
Statement s=new MethodEntryStatement(N.getNode());
addNode(s);
result.add(s);
}
return result.iterator();
}
case METHOD_ENTRY:
Collection<Statement> result=HashSetFactory.make(5);
if (!cOptions.equals(ControlDependenceOptions.NONE)) {
for (Iterator<? extends CGNode> it=cg.getPredNodes(N.getNode()); it.hasNext(); ) {
CGNode caller=it.next();
PDG pdg=getPDG(caller);
for (Iterator<CallSiteReference> it2=caller.getPossibleSites(N.getNode()); it2.hasNext(); ) {
CallSiteReference site=it2.next();
IR ir=caller.getIR(new WarningSet());
IntSet indices=ir.getCallInstructionIndices(site);
for (IntIterator ii=indices.intIterator(); ii.hasNext(); ) {
int i=ii.next();
SSAInvokeInstruction call=(SSAInvokeInstruction)ir.getInstructions()[i];
Statement s=pdg.ssaInstruction2Statement(call);
addNode(s);
result.add(s);
}
}
}
}
return result.iterator();
default :
Assertions.UNREACHABLE(N.getKind().toString());
return null;
}
}

Fixed version (ground truth):
public Iterator<? extends Statement> getPredNodes(Statement N){
  if (Assertions.verifyAssertions && dOptions.isIgnoreExceptions()) {
    Assertions._assert(!N.getKind().equals(Kind.EXC_RET_CALLEE));
    Assertions._assert(!N.getKind().equals(Kind.EXC_RET_CALLER));
  }
switch (N.getKind()) {
case NORMAL:
case PHI:
case PI:
case EXC_RET_CALLEE:
case NORMAL_RET_CALLEE:
case PARAM_CALLER:
case HEAP_PARAM_CALLER:
case HEAP_RET_CALLEE:
case CATCH:
    return getPDG(N.getNode()).getPredNodes(N);
case EXC_RET_CALLER:
{
    ParamStatement.ExceptionalReturnCaller nrc=(ParamStatement.ExceptionalReturnCaller)N;
    SSAInvokeInstruction call=nrc.getCall();
    Collection<Statement> result=new Iterator2Collection<Statement>(getPDG(N.getNode()).getPredNodes(N));
    if (!dOptions.equals(DataDependenceOptions.NONE)) {
      for (      CGNode t : N.getNode().getPossibleTargets(call.getCallSite())) {
        Statement s=new ParamStatement.ExceptionalReturnCallee(t);
        addNode(s);
        result.add(s);
      }
    }
    return result.iterator();
  }
case NORMAL_RET_CALLER:
{
  ParamStatement.NormalReturnCaller nrc=(ParamStatement.NormalReturnCaller)N;
  SSAInvokeInstruction call=nrc.getCall();
  Collection<Statement> result=new Iterator2Collection<Statement>(getPDG(N.getNode()).getPredNodes(N));
  if (!dOptions.equals(DataDependenceOptions.NONE)) {
    for (    CGNode t : N.getNode().getPossibleTargets(call.getCallSite())) {
      Statement s=new ParamStatement.NormalReturnCallee(t);
      addNode(s);
      result.add(s);
    }
  }
  return result.iterator();
}
case HEAP_RET_CALLER:
{
HeapStatement.ReturnCaller r=(HeapStatement.ReturnCaller)N;
SSAInvokeInstruction call=r.getCall();
Collection<Statement> result=new Iterator2Collection<Statement>(getPDG(N.getNode()).getPredNodes(N));
if (!dOptions.equals(DataDependenceOptions.NONE)) {
  for (  CGNode t : N.getNode().getPossibleTargets(call.getCallSite())) {
    if (mod.get(t).contains(r.getLocation())) {
      Statement s=new HeapStatement.ReturnCallee(t,r.getLocation());
      addNode(s);
      result.add(s);
    }
  }
}
return result.iterator();
}
case PARAM_CALLEE:
{
ParamStatement.ParamCallee pac=(ParamStatement.ParamCallee)N;
int parameterIndex=pac.getValueNumber() - 1;
Collection<Statement> result=HashSetFactory.make(5);
if (!dOptions.equals(DataDependenceOptions.NONE)) {
for (Iterator<? extends CGNode> it=cg.getPredNodes(N.getNode()); it.hasNext(); ) {
  CGNode caller=it.next();
  for (Iterator<CallSiteReference> it2=caller.getPossibleSites(N.getNode()); it2.hasNext(); ) {
    CallSiteReference site=it2.next();
    IR ir=caller.getIR(new WarningSet());
    IntSet indices=ir.getCallInstructionIndices(site);
    for (IntIterator ii=indices.intIterator(); ii.hasNext(); ) {
      int i=ii.next();
      SSAInvokeInstruction call=(SSAInvokeInstruction)ir.getInstructions()[i];
      int p=call.getUse(parameterIndex);
      Statement s=new ParamStatement.ParamCaller(caller,call,p);
      addNode(s);
      result.add(s);
    }
  }
}
}
if (!cOptions.equals(ControlDependenceOptions.NONE)) {
Statement s=new MethodEntryStatement(N.getNode());
addNode(s);
result.add(s);
}
return result.iterator();
}
case HEAP_PARAM_CALLEE:
{
HeapStatement.ParamCallee hpc=(HeapStatement.ParamCallee)N;
Collection<Statement> result=HashSetFactory.make(5);
if (!dOptions.equals(DataDependenceOptions.NONE)) {
for (Iterator<? extends CGNode> it=cg.getPredNodes(N.getNode()); it.hasNext(); ) {
CGNode caller=it.next();
for (Iterator<CallSiteReference> it2=caller.getPossibleSites(N.getNode()); it2.hasNext(); ) {
  CallSiteReference site=it2.next();
  IR ir=caller.getIR(new WarningSet());
  IntSet indices=ir.getCallInstructionIndices(site);
  for (IntIterator ii=indices.intIterator(); ii.hasNext(); ) {
    int i=ii.next();
    SSAInvokeInstruction call=(SSAInvokeInstruction)ir.getInstructions()[i];
    Statement s=new HeapStatement.ParamCaller(caller,call,hpc.getLocation());
    addNode(s);
    result.add(s);
  }
}
}
}
if (!cOptions.equals(ControlDependenceOptions.NONE)) {
Statement s=new MethodEntryStatement(N.getNode());
addNode(s);
result.add(s);
}
return result.iterator();
}
case METHOD_ENTRY:
Collection<Statement> result=HashSetFactory.make(5);
if (!cOptions.equals(ControlDependenceOptions.NONE)) {
for (Iterator<? extends CGNode> it=cg.getPredNodes(N.getNode()); it.hasNext(); ) {
CGNode caller=it.next();
PDG pdg=getPDG(caller);
for (Iterator<CallSiteReference> it2=caller.getPossibleSites(N.getNode()); it2.hasNext(); ) {
CallSiteReference site=it2.next();
IR ir=caller.getIR(new WarningSet());
IntSet indices=ir.getCallInstructionIndices(site);
for (IntIterator ii=indices.intIterator(); ii.hasNext(); ) {
int i=ii.next();
SSAInvokeInstruction call=(SSAInvokeInstruction)ir.getInstructions()[i];
Statement s=pdg.ssaInstruction2Statement(call);
addNode(s);
result.add(s);
}
}
}
}
return result.iterator();
default :
Assertions.UNREACHABLE(N.getKind().toString());
return null;
}
}