Program: 40805
Project: 40805
Buggy source:
/** 
 * create single-instruction basic-blocks distinguish blocks inside exception handler from other blocks. This is pretty horrible.
 */
private void createBasicBlocks(){
  List<IBasicBlock> basicBlockList=new ArrayList<IBasicBlock>();
  entry=0;
  entryBlock=new SingleInstructionBasicBlock(entry,null,-1);
  entryBlock.setIsEntryBlock(true);
  basicBlockList.add(entryBlock);
  for (Iterator it=cfg.iterator(); it.hasNext(); ) {
    BasicBlock bb=(BasicBlock)it.next();
    for (Iterator phiIt=bb.iteratePhis(); phiIt.hasNext(); ) {
      SSAPhiInstruction phi=(SSAPhiInstruction)phiIt.next();
      if (phi != null) {
        int blockNum=basicBlockList.size();
        basicBlockList.add(new SingleInstructionBasicBlock(blockNum,phi,-1));
      }
    }
    for (Iterator piIt=bb.iteratePis(); piIt.hasNext(); ) {
      SSAPiInstruction pi=(SSAPiInstruction)piIt.next();
      if (pi != null) {
        int blockNum=basicBlockList.size();
        basicBlockList.add(new SingleInstructionBasicBlock(blockNum,pi,-1));
      }
    }
    for (int i=bb.getFirstInstructionIndex(); i <= bb.getLastInstructionIndex(); i++) {
      SSAInstruction s=instructions[i];
      if (s != null) {
        int blockNum=basicBlockList.size();
        basicBlockList.add(new SingleInstructionBasicBlock(blockNum,s,i));
      }
    }
    if (bb instanceof ExceptionHandlerBasicBlock) {
      ExceptionHandlerBasicBlock ebb=(ExceptionHandlerBasicBlock)bb;
      SSAInstruction catchInst=ebb.getCatchInstruction();
      if (catchInst != null) {
        int blockNum=basicBlockList.size();
        new SingleInstructionExceptionHandlerBlock(blockNum,catchInst);
      }
    }
  }
  exit=basicBlockList.size();
  exitBlock=new SingleInstructionBasicBlock(exit,null,-1);
  exitBlock.setIsExitBlock(true);
  basicBlockList.add(exitBlock);
  basicBlocks=new SingleInstructionBasicBlock[basicBlockList.size()];
  for (int i=0; i < basicBlockList.size(); i++) {
    SingleInstructionBasicBlock sibb=(SingleInstructionBasicBlock)basicBlockList.get(i);
    basicBlocks[i]=sibb;
    SSAInstruction blockInstruction=sibb.getInstruction();
    if (blockInstruction != null) {
      instructionToBlock.put(blockInstruction,sibb);
    }
  }
}

Fixed version (ground truth):
/** 
 * create single-instruction basic-blocks distinguish blocks inside exception handler from other blocks. This is pretty horrible.
 */
private void createBasicBlocks(){
  List<IBasicBlock> basicBlockList=new ArrayList<IBasicBlock>();
  entry=0;
  entryBlock=new SingleInstructionBasicBlock(entry,null,-1);
  entryBlock.setIsEntryBlock(true);
  basicBlockList.add(entryBlock);
  for (Iterator it=cfg.iterator(); it.hasNext(); ) {
    BasicBlock bb=(BasicBlock)it.next();
    for (Iterator phiIt=bb.iteratePhis(); phiIt.hasNext(); ) {
      SSAPhiInstruction phi=(SSAPhiInstruction)phiIt.next();
      if (phi != null) {
        int blockNum=basicBlockList.size();
        basicBlockList.add(new SingleInstructionBasicBlock(blockNum,phi,-1));
      }
    }
    for (Iterator piIt=bb.iteratePis(); piIt.hasNext(); ) {
      SSAPiInstruction pi=(SSAPiInstruction)piIt.next();
      if (pi != null) {
        int blockNum=basicBlockList.size();
        basicBlockList.add(new SingleInstructionBasicBlock(blockNum,pi,-1));
      }
    }
    for (int i=bb.getFirstInstructionIndex(); i <= bb.getLastInstructionIndex(); i++) {
      SSAInstruction s=instructions[i];
      if (s != null) {
        int blockNum=basicBlockList.size();
        basicBlockList.add(new SingleInstructionBasicBlock(blockNum,s,i));
      }
    }
    if (bb instanceof ExceptionHandlerBasicBlock) {
      ExceptionHandlerBasicBlock ebb=(ExceptionHandlerBasicBlock)bb;
      SSAInstruction catchInst=ebb.getCatchInstruction();
      if (catchInst != null) {
        int blockNum=basicBlockList.size();
        basicBlockList.add(new SingleInstructionExceptionHandlerBlock(blockNum,catchInst));
      }
    }
  }
  exit=basicBlockList.size();
  exitBlock=new SingleInstructionBasicBlock(exit,null,-1);
  exitBlock.setIsExitBlock(true);
  basicBlockList.add(exitBlock);
  basicBlocks=new SingleInstructionBasicBlock[basicBlockList.size()];
  for (int i=0; i < basicBlockList.size(); i++) {
    SingleInstructionBasicBlock sibb=(SingleInstructionBasicBlock)basicBlockList.get(i);
    basicBlocks[i]=sibb;
    SSAInstruction blockInstruction=sibb.getInstruction();
    if (blockInstruction != null) {
      instructionToBlock.put(blockInstruction,sibb);
    }
  }
}