Program: 40591
Project: 40591
Buggy source:
public boolean hasEdge(Statement src,Statement dst){
  addPDGStatementNodes(src.getNode());
  addPDGStatementNodes(dst.getNode());
switch (src.getKind()) {
case NORMAL:
    if (cOptions.equals(ControlDependenceOptions.NONE)) {
      return getPDG(src.getNode()).hasEdge(src,dst);
    }
 else {
      NormalStatement ns=(NormalStatement)src;
      if (dst instanceof MethodEntryStatement) {
        if (ns.getInstruction() instanceof SSAAbstractInvokeInstruction) {
          SSAAbstractInvokeInstruction call=(SSAAbstractInvokeInstruction)ns.getInstruction();
          return cg.getPossibleTargets(src.getNode(),call.getCallSite()).contains(dst.getNode());
        }
 else {
          return false;
        }
      }
 else {
        return getPDG(src.getNode()).hasEdge(src,dst);
      }
    }
case PHI:
case EXC_RET_CALLER:
case NORMAL_RET_CALLER:
case PARAM_CALLEE:
case HEAP_PARAM_CALLEE:
case HEAP_RET_CALLER:
case METHOD_ENTRY:
  return getPDG(src.getNode()).hasEdge(src,dst);
case EXC_RET_CALLEE:
{
  if (dOptions.equals(DataDependenceOptions.NONE)) {
    return false;
  }
  if (dst.getKind().equals(Kind.EXC_RET_CALLER)) {
    ExceptionalReturnCaller r=(ExceptionalReturnCaller)dst;
    return cg.getPossibleTargets(r.getNode(),r.getInstruction().getCallSite()).contains(src.getNode());
  }
 else {
    return false;
  }
}
case NORMAL_RET_CALLEE:
{
if (dOptions.equals(DataDependenceOptions.NONE)) {
  return false;
}
if (dst.getKind().equals(Kind.NORMAL_RET_CALLER)) {
  NormalReturnCaller r=(NormalReturnCaller)dst;
  return cg.getPossibleTargets(r.getNode(),r.getInstruction().getCallSite()).contains(src.getNode());
}
 else {
  return false;
}
}
case HEAP_RET_CALLEE:
{
if (dOptions.equals(DataDependenceOptions.NONE)) {
return false;
}
if (dst.getKind().equals(Kind.HEAP_RET_CALLER)) {
HeapStatement.HeapReturnCaller r=(HeapStatement.HeapReturnCaller)dst;
HeapStatement h=(HeapStatement)src;
return h.getLocation().equals(r.getLocation()) && cg.getPossibleTargets(r.getNode(),r.getCall().getCallSite()).contains(src.getNode());
}
 else {
return false;
}
}
case PARAM_CALLER:
{
if (dOptions.equals(DataDependenceOptions.NONE)) {
return false;
}
if (dst.getKind().equals(Kind.PARAM_CALLEE)) {
ParamCallee callee=(ParamCallee)dst;
ParamCaller caller=(ParamCaller)src;
return caller.getValueNumber() == callee.getValueNumber() && cg.getPossibleTargets(caller.getNode(),caller.getInstruction().getCallSite()).contains(callee.getNode());
}
 else {
return false;
}
}
case HEAP_PARAM_CALLER:
if (dOptions.equals(DataDependenceOptions.NONE)) {
return false;
}
if (dst.getKind().equals(Kind.HEAP_PARAM_CALLEE)) {
HeapStatement.HeapParamCallee callee=(HeapStatement.HeapParamCallee)dst;
HeapStatement.HeapParamCaller caller=(HeapStatement.HeapParamCaller)src;
return caller.getLocation().equals(callee.getLocation()) && cg.getPossibleTargets(caller.getNode(),caller.getCall().getCallSite()).contains(callee.getNode());
}
 else {
return false;
}
default :
Assertions.UNREACHABLE();
return false;
}
}

Fixed version (ground truth):
public boolean hasEdge(Statement src,Statement dst){
  addPDGStatementNodes(src.getNode());
  addPDGStatementNodes(dst.getNode());
switch (src.getKind()) {
case NORMAL:
    if (cOptions.equals(ControlDependenceOptions.NONE)) {
      return getPDG(src.getNode()).hasEdge(src,dst);
    }
 else {
      NormalStatement ns=(NormalStatement)src;
      if (dst instanceof MethodEntryStatement) {
        if (ns.getInstruction() instanceof SSAAbstractInvokeInstruction) {
          SSAAbstractInvokeInstruction call=(SSAAbstractInvokeInstruction)ns.getInstruction();
          return cg.getPossibleTargets(src.getNode(),call.getCallSite()).contains(dst.getNode());
        }
 else {
          return false;
        }
      }
 else {
        return getPDG(src.getNode()).hasEdge(src,dst);
      }
    }
case PHI:
case PI:
case EXC_RET_CALLER:
case NORMAL_RET_CALLER:
case PARAM_CALLEE:
case HEAP_PARAM_CALLEE:
case HEAP_RET_CALLER:
case METHOD_ENTRY:
  return getPDG(src.getNode()).hasEdge(src,dst);
case EXC_RET_CALLEE:
{
  if (dOptions.equals(DataDependenceOptions.NONE)) {
    return false;
  }
  if (dst.getKind().equals(Kind.EXC_RET_CALLER)) {
    ExceptionalReturnCaller r=(ExceptionalReturnCaller)dst;
    return cg.getPossibleTargets(r.getNode(),r.getInstruction().getCallSite()).contains(src.getNode());
  }
 else {
    return false;
  }
}
case NORMAL_RET_CALLEE:
{
if (dOptions.equals(DataDependenceOptions.NONE)) {
  return false;
}
if (dst.getKind().equals(Kind.NORMAL_RET_CALLER)) {
  NormalReturnCaller r=(NormalReturnCaller)dst;
  return cg.getPossibleTargets(r.getNode(),r.getInstruction().getCallSite()).contains(src.getNode());
}
 else {
  return false;
}
}
case HEAP_RET_CALLEE:
{
if (dOptions.equals(DataDependenceOptions.NONE)) {
return false;
}
if (dst.getKind().equals(Kind.HEAP_RET_CALLER)) {
HeapStatement.HeapReturnCaller r=(HeapStatement.HeapReturnCaller)dst;
HeapStatement h=(HeapStatement)src;
return h.getLocation().equals(r.getLocation()) && cg.getPossibleTargets(r.getNode(),r.getCall().getCallSite()).contains(src.getNode());
}
 else {
return false;
}
}
case PARAM_CALLER:
{
if (dOptions.equals(DataDependenceOptions.NONE)) {
return false;
}
if (dst.getKind().equals(Kind.PARAM_CALLEE)) {
ParamCallee callee=(ParamCallee)dst;
ParamCaller caller=(ParamCaller)src;
return caller.getValueNumber() == callee.getValueNumber() && cg.getPossibleTargets(caller.getNode(),caller.getInstruction().getCallSite()).contains(callee.getNode());
}
 else {
return false;
}
}
case HEAP_PARAM_CALLER:
if (dOptions.equals(DataDependenceOptions.NONE)) {
return false;
}
if (dst.getKind().equals(Kind.HEAP_PARAM_CALLEE)) {
HeapStatement.HeapParamCallee callee=(HeapStatement.HeapParamCallee)dst;
HeapStatement.HeapParamCaller caller=(HeapStatement.HeapParamCaller)src;
return caller.getLocation().equals(callee.getLocation()) && cg.getPossibleTargets(caller.getNode(),caller.getCall().getCallSite()).contains(callee.getNode());
}
 else {
return false;
}
default :
Assertions.UNREACHABLE(src.getKind());
return false;
}
}