Program: 100077
Project: 100077
Buggy source:
Iterator<PointerKey> getArrayWrites(PointerKey arrayRef){
  Collection<MemoryAccess> arrayWrites=mam.getArrayWrites(arrayRef);
  for (  MemoryAccess a : arrayWrites) {
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> written=new ArrayList<PointerKey>();
  for (  MemoryAccess a : arrayWrites) {
    final CGNode node=a.getNode();
    IR ir=node.getIR();
    SSAInstruction instruction=ir.getInstructions()[a.getInstructionIndex()];
    if (instruction == null) {
      continue;
    }
    if (instruction instanceof SSAArrayStoreInstruction) {
      SSAArrayStoreInstruction s=(SSAArrayStoreInstruction)instruction;
      PointerKey r=heapModel.getPointerKeyForLocal(node,s.getValue());
      written.add(r);
    }
 else     if (instruction instanceof SSANewInstruction) {
      SSANewInstruction n=(SSANewInstruction)instruction;
      InstanceKey iKey=heapModel.getInstanceKeyForAllocation(node,n.getNewSite());
      IClass klass=iKey.getConcreteType();
      if (Assertions.verifyAssertions) {
        Assertions._assert(klass.isArrayClass() && ((ArrayClass)klass).getElementClass().isArrayClass());
      }
      int dim=0;
      InstanceKey lastInstance=iKey;
      while (klass != null && klass.isArrayClass()) {
        klass=((ArrayClass)klass).getElementClass();
        if (klass != null && klass.isArrayClass()) {
          InstanceKey ik=heapModel.getInstanceKeyForMultiNewArray(node,n.getNewSite(),dim);
          PointerKey pk=heapModel.getPointerKeyForArrayContents(lastInstance);
          written.add(pk);
          lastInstance=ik;
          dim++;
        }
      }
    }
 else {
      Assertions.UNREACHABLE();
    }
  }
  return written.iterator();
}

Fixed version (ground truth):
Iterator<PointerKey> getArrayWrites(PointerKey arrayRef){
  Collection<MemoryAccess> arrayWrites=mam.getArrayWrites(arrayRef);
  for (  MemoryAccess a : arrayWrites) {
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> written=new ArrayList<PointerKey>();
  for (  MemoryAccess a : arrayWrites) {
    final CGNode node=a.getNode();
    IR ir=node.getIR();
    SSAInstruction instruction=ir.getInstructions()[a.getInstructionIndex()];
    if (instruction == null) {
      continue;
    }
    if (instruction instanceof SSAArrayStoreInstruction) {
      SSAArrayStoreInstruction s=(SSAArrayStoreInstruction)instruction;
      PointerKey r=heapModel.getPointerKeyForLocal(node,s.getValue());
      written.add(r);
    }
 else     if (instruction instanceof SSANewInstruction) {
      SSANewInstruction n=(SSANewInstruction)instruction;
      InstanceKey iKey=heapModel.getInstanceKeyForAllocation(node,n.getNewSite());
      if (iKey == null) {
        continue;
      }
      IClass klass=iKey.getConcreteType();
      if (Assertions.verifyAssertions) {
        Assertions._assert(klass.isArrayClass() && ((ArrayClass)klass).getElementClass().isArrayClass());
      }
      int dim=0;
      InstanceKey lastInstance=iKey;
      while (klass != null && klass.isArrayClass()) {
        klass=((ArrayClass)klass).getElementClass();
        if (klass != null && klass.isArrayClass()) {
          InstanceKey ik=heapModel.getInstanceKeyForMultiNewArray(node,n.getNewSite(),dim);
          PointerKey pk=heapModel.getPointerKeyForArrayContents(lastInstance);
          written.add(pk);
          lastInstance=ik;
          dim++;
        }
      }
    }
 else {
      Assertions.UNREACHABLE();
    }
  }
  return written.iterator();
}