Program: 30774
Project: 30774
Buggy source:
private void reshuffleExistingColumnList(int columnCount,long pTransitionIndex){
  final long pIndexBase=pTransitionIndex + 8;
  final long pState=pIndexBase + columnCount * 8;
  for (int partitionIndex=0; partitionIndex < partitionCount; partitionIndex++) {
    int base=getColumnBase(partitionIndex);
    try {
      Path path=partitionPathGenerator.generate(this,partitionIndex);
      final long partitionRowCount=partitionRowCounts.getQuick(partitionIndex);
      Unsafe.getUnsafe().setMemory(pState,columnCount,(byte)0);
      for (int i=0; i < columnCount; i++) {
        if (isEntryToBeProcessed(pState,i)) {
          final int copyFrom=Unsafe.getUnsafe().getInt(pIndexBase + i * 8) - 1;
          if (copyFrom == i) {
            ReadOnlyColumn col=columns.getQuick(getPrimaryColumnIndex(base,i));
            if (col == null || col instanceof NullColumn || ff.exists(col.getFd())) {
              continue;
            }
            reloadColumnAt(path,columns,columnTops,i,base,partitionRowCount);
            continue;
          }
          if (copyFrom > -1) {
            fetchColumnsFrom(this.columns,this.columnTops,base,copyFrom);
            copyColumnsTo(this.columns,this.columnTops,base,i,partitionRowCount);
            int copyTo=Unsafe.getUnsafe().getInt(pIndexBase + i * 8 + 4) - 1;
            while (copyTo > -1 && isEntryToBeProcessed(pState,copyTo)) {
              copyColumnsTo(this.columns,this.columnTops,base,copyTo,partitionRowCount);
              copyTo=Unsafe.getUnsafe().getInt(pIndexBase + (copyTo - 1) * 8 + 4);
            }
            Misc.free(tempCopyStruct.mem1);
            Misc.free(tempCopyStruct.mem2);
          }
 else {
            createColumnInstanceAt(path,this.columns,this.columnTops,i,base,partitionRowCount);
          }
        }
      }
    }
  finally {
      path.trimTo(rootLen);
    }
  }
}

Fixed version (ground truth):
private void reshuffleExistingColumnList(int columnCount,long pTransitionIndex){
  final long pIndexBase=pTransitionIndex + 8;
  final long pState=pIndexBase + columnCount * 8;
  for (int partitionIndex=0; partitionIndex < partitionCount; partitionIndex++) {
    int base=getColumnBase(partitionIndex);
    try {
      Path path=partitionPathGenerator.generate(this,partitionIndex);
      final long partitionRowCount=partitionRowCounts.getQuick(partitionIndex);
      Unsafe.getUnsafe().setMemory(pState,columnCount,(byte)0);
      for (int i=0; i < columnCount; i++) {
        if (isEntryToBeProcessed(pState,i)) {
          final int copyFrom=Unsafe.getUnsafe().getInt(pIndexBase + i * 8) - 1;
          if (copyFrom == i) {
            ReadOnlyColumn col=columns.getQuick(getPrimaryColumnIndex(base,i));
            if (col instanceof ReadOnlyMemory && !ff.exists(col.getFd())) {
              reloadColumnAt(path,columns,columnTops,i,base,partitionRowCount);
            }
            continue;
          }
          if (copyFrom > -1) {
            fetchColumnsFrom(this.columns,this.columnTops,base,copyFrom);
            copyColumnsTo(this.columns,this.columnTops,base,i,partitionRowCount);
            int copyTo=Unsafe.getUnsafe().getInt(pIndexBase + i * 8 + 4) - 1;
            while (copyTo > -1 && isEntryToBeProcessed(pState,copyTo)) {
              copyColumnsTo(this.columns,this.columnTops,base,copyTo,partitionRowCount);
              copyTo=Unsafe.getUnsafe().getInt(pIndexBase + (copyTo - 1) * 8 + 4);
            }
            Misc.free(tempCopyStruct.mem1);
            Misc.free(tempCopyStruct.mem2);
          }
 else {
            createColumnInstanceAt(path,this.columns,this.columnTops,i,base,partitionRowCount);
          }
        }
      }
    }
  finally {
      path.trimTo(rootLen);
    }
  }
}